﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
18450,New safe action to add rewrite rules on,simonwheatley,,"Currently I don't believe it's possible to meet the following two criteria:

* Not flush rewrite rules on every page load
* Ensure that you always have your rewrite rules available

The problem arises when Plugin A has not yet added it's rewrite rules, but Plugin B calls ```flush_rewrite_rules```. Plugin A is a good citizen, and doesn't call ```flush_rewrite_rules``` unless it needs to and so now it's rewrite rules are no longer present. (See http://wordpress.stackexchange.com/questions/26029/when-to-call-add-rewrite-rule-for-safety for more.)

Westi suggested that hooks on delete_option and get_option of 'rewrite_rules' might work. This covers almost all situations, except the one where permalinks are off and then get turned on again when neither the delete_option or get_option actions/filters are fired.

Devs could hook the new action for their ```add_rewrite_rule``` calls, and use their own methodology to determine when to call ```flush_rewrite_rules```.

Two attachments:

* Example plugin, showing (hopefully) the problem with the existing situation
* Diff showing where the hook might be added

",enhancement,new,normal,Awaiting Review,Rewrite Rules,3.2.1,normal,,has-patch dev-feedback,westi mikeschinkel@… ejdanderson@… joost@… xoodrew@…
