wpseek.com
A WordPress-centric search engine for devs and theme authors
_deprecated_hook is private and should not be used in themes or plugins directly.
_deprecated_hook › WordPress Function
Since4.6.0
Deprecatedn/a
› _deprecated_hook ( $hook, $version, $replacement = '', $message = '' )
| Access: |
|
| Parameters: (4) |
|
| Defined at: |
|
| Codex: | |
| Change Log: |
|
Marks a deprecated action or filter hook as deprecated and throws a notice.
Use the {@see 'deprecated_hook_run'} action to get the backtrace describing where the deprecated hook was called. Default behavior is to trigger a user error ifWP_DEBUG is true.
This function is called by the do_action_deprecated() and apply_filters_deprecated()
functions, and so generally does not need to be called directly.Related Functions: _deprecated_file, _deprecated_class, _deprecated_constructor, _deprecated_function, _deprecated_argument
Source
function _deprecated_hook( $hook, $version, $replacement = '', $message = '' ) {
/**
* Fires when a deprecated hook is called.
*
* @since 4.6.0
*
* @param string $hook The hook that was called.
* @param string $replacement The hook that should be used as a replacement.
* @param string $version The version of WordPress that deprecated the argument used.
* @param string $message A message regarding the change.
*/
do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message );
/**
* Filters whether to trigger deprecated hook errors.
*
* @since 4.6.0
*
* @param bool $trigger Whether to trigger deprecated hook errors. Requires
* `WP_DEBUG` to be defined true.
*/
if ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) {
$message = empty( $message ) ? '' : ' ' . $message;
if ( $replacement ) {
$message = sprintf(
/* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */
__( 'Hook %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$hook,
$version,
$replacement
) . $message;
} else {
$message = sprintf(
/* translators: 1: WordPress hook name, 2: Version number. */
__( 'Hook %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$hook,
$version
) . $message;
}
wp_trigger_error( '', $message, E_USER_DEPRECATED );
}
}