[wp-trac] [WordPress Trac] #29118: Registering rewrite rules is hard, so let's introduce remove_rewrite_rule.

WordPress Trac noreply at wordpress.org
Fri Jun 3 14:03:13 UTC 2016


#29118: Registering rewrite rules is hard, so let's introduce remove_rewrite_rule.
---------------------------+------------------------------
 Reporter:  ericlewis      |       Owner:
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Rewrite Rules  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:
---------------------------+------------------------------

Comment (by jsherk):

 I am working on a plugin and just discovered this problem.

 You need to use 'init' to keep adding your rule in case another plugin
 calls flush_rewrite_rules(), otherwise it will be removed.

 But calling flush_rewrite_rules() on deactivation will not remove the rule
 because it was just added on the init call first.

 I like ericlewis suggestion of adding a remove_rewrite_rule that could be
 called on deactivation so the rule is actually removed.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29118#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list