Custom do_action seems to not be calling?
-
Hey all,
Quick foundation, there is a plugin that upon the admin uploading a file to the database fires off an action. (If it matters, this do_action is in a static function in the plugin’s files.)
I hook into this with an add_action which performs some logic. Within this logic, I fire off my own CUSTOM do_action (to send a user an email). It appears this do_action never gets triggered, I can’t figure out why?
Here’s the basic structure of the code:
Plugin class
static function onInsertFile() { // logic... do_action('file-edited', $file, $data); }
My custom plugin class
public function register() { add_action( 'file-edited', array( $this, 'onFileEdited' ), 10, 2 ); add_action( 'send-user-email', array( $this, 'sendUserEmail' ), 10, 1 ); } public function onFileEdited( $file, $data ) { // logic... do_action( 'send-user-email', $email_stuff ); } public function sendUserEmail( $args ) { // Code here is never executed??? }
There must be some type of gotcha here going on because this all seems solid to me? Anything to do with static scopes?
(For the sake of this example, and testing, both add_actions are in the same class yet that send-user-email one is still never executed.)
- The topic ‘Custom do_action seems to not be calling?’ is closed to new replies.