WordPress.org

Support

Support » How-To and Troubleshooting » Two hooks on the same action

Two hooks on the same action

  • Situation: there are plugins A and B.
    Both plugins written by me, both plugins override function the_content

    A function the_content A-plugin displays the following
    CONTENT + ‘1111’

    Function the_content B-plugin displays the following
    CONTENT + ‘2222’

    I need that would not conflict plugins.
    I need that result should be the next:
    CONTENT + ‘1111’ + ‘2222’

    That is, first worked function the_content of A plugin, and then this result be applicable function code
    the_content of plugin B…

    Please healp me.
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • catacaustic

    @catacaustic

    very awesome

    You just need to set the priority parameter for the ‘add_action()’ function. Set it lower in your first plugin and higher in your second plugin. As 10 is the default, I’d suggest setting it to something like 20 in your first plugin and 21 in the second plugin. That way you’ll keep the extra added content at the end of the content as much as possible.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Two hooks on the same action’ is closed to new replies.
Skip to toolbar