admin管理员组文章数量:1415644
I found an odd hook in the WordPress documentation. deprecated_argument_run
which has this "enlightening description".
Fires when a deprecated argument is called.
I pretty much figured that much out from the hook name.
What is this hook's intended use?
I found an odd hook in the WordPress documentation. deprecated_argument_run
which has this "enlightening description".
Fires when a deprecated argument is called.
I pretty much figured that much out from the hook name.
What is this hook's intended use?
Share Improve this question asked Aug 14, 2019 at 5:37 Matthew Brown aka Lord MattMatthew Brown aka Lord Matt 1,0683 gold badges13 silver badges34 bronze badges 1 |1 Answer
Reset to default 1As @sally-cj already hinted at in his comment this is used for debugging purposes, helping developers by notifying them of the use of deprecated arguments in their codebase.
In core this is for example used to alert people of wrong arguments when using the REST API: https://core.trac.wordpress/browser/branches/5.2/src/wp-includes/rest-api.php#L177
But you could add your own function to that hook that does whatever you find useful - send a mail, log to a file,...
Core uses it inside the (private, so not intended for use by non core code) _deprecated_argument
function.
And that function _deprecated_argument
is actually used all over the place in core, for example inside get_the_author
to give one random example.
本文标签: hooksWhat is deprecatedargumentrun meant to do exactly
版权声明:本文标题:hooks - What is deprecated_argument_run meant to do exactly? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745241860a2649375.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
deprecated_argument_run
that will be called that can be used to get the backtrace up to what file and function used the deprecated argument." -_deprecated_argument()
. That might help? – Sally CJ Commented Aug 14, 2019 at 6:24