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?

0

1 Answer 1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.