Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
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?
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.
Required, but never shown