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?


1 Answer 1


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 and acknowledge you have read our privacy policy.