Closed andrewl64 closed 3 years ago
whats the solution?
whats the solution?
I ended up leaving the if statement within the someFunc()
function. Still new to this boilerplate so I'll go through the code again once I'm done with the test plugin I'm building and see if there's a way I can use the above condition in the define_admin_hooks()
directly.
I have the following function defined in
admin/class-plugin-name-admin.php
:And I have the following inside
define_admin_hooks()
:What I would like to do is conditionally add the above
add_action
based on a checkbox setting that I have registered for the plugin.What I have currently done is add the condition within the
someFunc()
function itself inadmin/class-plugin-name-admin.php
like this:How would I add the condition in the
define_admin_hooks()
function to not even load the action in the first place if the condition is not met? Something like this: