WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 using this function to add a custom end point to the WordPress urls

add_rewrite_endpoint('print', EP_ALL);

When the plug-in gets deactivated, I run this function


This flush the rewrite rules, and disable the 'print' end point. Fine. But I'm thinking of other plug-ins. What if other plug-ins have registered some rewrite rules. Will they be flushed too?

If so, how can I preserve them as this will run their rewrite rules. And the same being for my plug-in. Do you have to re-register the rules everytime WordPress is called?

share|improve this question
up vote 2 down vote accepted

What flush_rewrite_rules(); does is call $wp_rewrite->flush_rules(); (Also called when updating permalinks). All plugins rewrite rules are regenerated then, so you dont need to worry about other plugins rules being "missing".

Also is not a good idea to call this function (flush_rewrite_rule) on hooks that run each time wordpress is loaded, and is enough to call add_rewrite_endpoint or add_rewrite_rule on activation or deactivation hooks.

share|improve this answer
It was my understanding that you should added the rewrite rule on each load, but only flush on activation/deactivation. – chrisguitarguy Sep 28 '11 at 14:19

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.