WordPress.org

Forums

Two hooks on the same action (3 posts)

  1. ploret
    Member
    Posted 1 year ago #

    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!

  2. catacaustic
    very awesome
    Posted 1 year ago #

    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.

  3. ploret
    Member
    Posted 1 year ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags