[wp-trac] [WordPress Trac] #18450: New safe action to add rewrite rules on
WordPress Trac
wp-trac at lists.automattic.com
Tue Aug 16 19:56:10 UTC 2011
#18450: New safe action to add rewrite rules on
---------------------------+------------------------------------
Reporter: simonwheatley | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Rewrite Rules | Version: 3.2.1
Severity: normal | Keywords: has-patch dev-feedback
---------------------------+------------------------------------
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
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18450>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list