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

WordPress Trac noreply at wordpress.org
Wed Jan 21 08:37:50 UTC 2015


#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 danielpataki):

 I don't want to edit the Codex on this one because I'm not certain, but
 isn't the Codex on flush_rewrite_riles incorrect?
 http://codex.wordpress.org/Function_Reference/flush_rewrite_rules

 It recommends doing the following:

 {{{
 function myplugin_flush_rewrites() {
         // call your CPT registration function here (it should also be
 hooked into 'init')
         myplugin_custom_post_types_registration();
         flush_rewrite_rules();
 }

 register_activation_hook( __FILE__, 'myplugin_flush_rewrites' );

 function myplugin_flush_rewrites_deactivate() {
         flush_rewrite_rules();
 }

 register_deactivation_hook( __FILE__, 'myplugin_flush_rewrites_deactivate'
 );
 }}}

 This is fine for activation but simply doesn't work on deactivation for
 reasons discussed in this thread.

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


More information about the wp-trac mailing list