0

I would like to make function only callable by a specific action, in this case the register_activation_hook() function.

How can I do this?

2

There's a Wordpress function current_filter() that retrieves the name of the current filter or hook that called a function/method. You can match it to a whitelist and either end or continue the function based on the result.

Your Answer

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