[wp-trac] [WordPress Trac] #30501: Prevent flushing rewrites during page load

WordPress Trac noreply at wordpress.org
Wed Jan 14 07:22:27 UTC 2015


#30501: Prevent flushing rewrites during page load
-------------------------------------------------+-------------------------
 Reporter:  joostdevalk                          |       Owner:
     Type:  defect (bug)                         |  SergeyBiryukov
 Priority:  normal                               |      Status:  reopened
Component:  Permalinks                           |   Milestone:  4.2
 Severity:  normal                               |     Version:
 Keywords:  has-patch dev-feedback 4.2-early     |  Resolution:
  commit                                         |     Focuses:
-------------------------------------------------+-------------------------

Comment (by Denis-de-Bernardy):

 A possible workaround off the top of my head:


 {{{
 static $do_hard_later;

 if ( ! did_action( 'wp_loaded' ) ) {
   add_action( 'wp_loaded', array( $this, 'flush_rules' ) );
   $do_hard_later ||= $hard;
   return;
 }
 elseif ( isset( $do_hard_later ) && doing_action( 'wp_loaded' ) ) {
   $hard ||= $do_hard_later;
   $do_hard_later = null;
 }
 }}}

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


More information about the wp-trac mailing list