除了@Welcher的答案:
核心中有一些很好的“ 墓地 ”示例,其中“ 功能消失了 ”。
您可以将它们用作准则,例如关于文档。
下面是一个这样的例子permalink_link()
下wp-includes/deprecated.php
/**
* Print the permalink of the current post in the loop.
*
* @since 0.71
* @deprecated 1.2.0 Use the_permalink()
* @see the_permalink()
*/
function permalink_link() {
_deprecated_function( __FUNCTION__, '1.2', 'the_permalink()' );
the_permalink();
}
这_deprecated_function
是解释输入参数的函数的内联文档:
/**
* Mark a function as deprecated and inform when it has been used.
*
* There is a hook deprecated_function_run that will be called that can be used
* to get the backtrace up to what file and function called the deprecated
* function.
*
* The current behavior is to trigger a user error if WP_DEBUG is true.
*
* This function is to be used in every function that is deprecated.
*
* @since 2.5.0
* @access private
*
* @param string $function The function that was called.
* @param string $version The version of WordPress that deprecated the function.
* @param string $replacement Optional. The function that should have been called.
* Default null.
*/