• I’ve been looking over add_action() and do_action() as this seems like what I need, but I need a bit more information.

    So let’s say I wrote a discord hook bot that can run based on information sent to it… This is no issue.

    For example:

    However, I want to latch on to 3rd party plugin and every time that function is executed, then have the bot say something in Discord.

    Does it require me to or the original author to have added the function to add_action()?

    So let’s say I have another plugin that I made… with

    
    function origin_func($args)
    {
     //stuff
    }
    

    Do I need to:

    
    add_action( 'origin_function_action' 'origin_func')
    

    In either the original or new and then in the new discord plugin…

    How to I check to see if that custom action is run and then have the new one run?

    Thanks!

    • This topic was modified 4 years, 10 months ago by Felty.
    • This topic was modified 4 years, 10 months ago by Felty.
Viewing 1 replies (of 1 total)
  • The third-party plugin needs to include do_action. E.g.:
    do_action('third_party_hook');

    In your own code, you use add_action:
    add_action('third_party_hook', 'your_function');

Viewing 1 replies (of 1 total)
  • The topic ‘Running a function when a 3rd party php function runs’ is closed to new replies.