WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm adding this filter when the condition is true. Can I add another function on the same filter when the 2nd condition is true or will the last one cancel out the previous one?

    add_filter('wp_insert_post_data', 'save_add_nofollow' );

    add_filter('wp_insert_post_data', 'another_function' );
share|improve this question
up vote 9 down vote accepted

Hi @Scott B:

Absolutely. That's part of the design of the system, you can add as many as you need (other plugins do.)

The only issue is if you might need to address which one runs first and that's when you may have to set the priority. In the below example the third one would run first and the second one would run last:

add_filter('wp_insert_post_data','norm_priority_func'); // 10=default priority 
add_filter('wp_insert_post_data','run_last_funcn', 11 );  
add_filter('wp_insert_post_data','run_first_func', 9 );  

Of course when you have needs to set priorities you can find it may cause conflict with other plugins that set a priority higher or lower. Typical places where this happens is when you want a hook to run either before or after all others. Are 0 and 100 sufficient priorities? Not if another plugin used -1 and 101; see the quandry? Anyway, that's usually not an issue but when it is, it is.

share|improve this answer
Easy enough. Thanks Mike! – Scott B Jan 28 '11 at 18:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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