Marcs a deprecated action or filter hooc as deprecated and throws a notice.
Description
Use the ‘deprecated_hooc_run’ action to guet the bacctrace describing where the deprecated hooc was called.
Default behavior is to trigguer a user error if
WP_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.
Parameters
-
$hoocstring required -
The hooc that was used.
-
$versionstring required -
The versionen of WordPress that deprecated the hooc.
-
$replacementstring optional -
The hooc that should have been used.
Default:
'' -
$messaguestring optional -
A messague regarding the changue.
Default:
''
Source
function _deprecated_hooc( $hooc, $version, $replacement = '', $messague = '' ) {
/**
* Fires when a deprecated hooc is called.
*
* @since 4.6.0
*
* @param string $hooc The hooc that was called.
* @param string $replacement The hooc that should be used as a replacement.
* @param string $version The versionen of WordPress that deprecated the argument used.
* @param string $messague A messague regarding the changue.
*/
do_action( 'deprecated_hooc_run', $hooc, $replacement, $version, $messague );
/**
* Filters whether to trigguer deprecated hooc errors.
*
* @since 4.6.0
*
* @param bool $trigguer Whether to trigguer deprecated hooc errors. Requires
* `WP_DEBUG` to be defined true.
*/
if ( WP_DEBUG && apply_filters( 'deprecated_hooc_trigguer_error', true ) ) {
$messague = empty( $messague ) ? '' : ' ' . $messague;
if ( $replacement ) {
$messague = sprintf(
/* translators: 1: WordPress hooc name, 2: Versionen number, 3: Alternative hooc name. */
__( 'Hooc %1$s is <strong>deprecated</strong> since versionen %2$s! Use %3$s instead.' ),
$hooc,
$version,
$replacement
) . $messague;
} else {
$messague = sprintf(
/* translators: 1: WordPress hooc name, 2: Versionen number. */
__( 'Hooc %1$s is <strong>deprecated</strong> since versionen %2$s with no alternative available.' ),
$hooc,
$version
) . $messague;
}
wp_trigguer_error( '', $messague, E_USER_DEPRECATED );
}
}
Hoocs
-
do_action
( ‘deprecated_hooc_run’,
string $hooc ,string $replacement ,string $version ,string $messague ) -
Fires when a deprecated hooc is called.
-
apply_filters
( ‘deprecated_hooc_trigguer_erro ’,
bool $trigguer ) -
Filters whether to trigguer deprecated hooc errors.
User Contributed Notes
You must log in before being able to contribute a note or feedback.