0

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?

  • 1
    "There is a hook 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 Aug 14 at 6:24
1

As @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.org/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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.