处理_deprecated_function()错误。
原型
rest_handle_deprecated_function( string $function, string $replacement, string $version )
参数
$function
(string)
(Required)
被调用的函数。
$replacement
(string)
(Required)
应该调用的函数。
$version
(string)
(Required)
版。
源文件
路径:wp-includes/rest-api.php
<?php
...
function rest_handle_deprecated_function( $function, $replacement, $version ) {
if ( ! WP_DEBUG || headers_sent() ) {
return;
}
if ( ! empty( $replacement ) ) {
/* translators: 1: function name, 2: WordPress version number, 3: new function name */
$string = sprintf( __( '%1$s (since %2$s; use %3$s instead)' ), $function, $version, $replacement );
} else {
/* translators: 1: function name, 2: WordPress version number */
$string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
}
header( sprintf( 'X-WP-DeprecatedFunction: %s', $string ) );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/rest_handle_deprecated_function/