0

Two of my plugins use the same filter hook: the_content. What happens in this case? Is there a priority handler, like which plugin will be served first?

I would like to use both of the plugins. I need to call one plugin first and then the second plugin will add more content onto the end of the first plugin.

What is the best approach to accomplish this? Or am I doing something wrong here?

1 Answer 1

4

There is priority as explained in the codex:

add_filter ( 'hook_name', 'your_filter', [priority], [accepted_args] );

Lower numbers are executed first, the default is 10.

If you have multiple functions at the same priority, they are run in the order in which they were added to the filter.

3
  • Is there a way to find out the order in which they are added to the filter? Another thing, is there any problem with my approach?
    – sakibmoon
    Commented Jan 14, 2014 at 21:06
  • 1
    This question tells you how to print out which filters are added. And it sounds to me like your plan will work.
    – hornj
    Commented Jan 14, 2014 at 21:18
  • can one use a number less than 10 for priority say, for example, 1 Commented Jan 9, 2022 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.