[wp-trac] [WordPress Trac] #32023: FOUND BUG - REWRITE_RULES need to be fired TWICE!

WordPress Trac noreply at wordpress.org
Mon Apr 20 15:05:07 UTC 2015


#32023: FOUND BUG - REWRITE_RULES need to be fired TWICE!
---------------------------+------------------------------
 Reporter:  selnomeria     |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Rewrite Rules  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------
Changes (by SergeyBiryukov):

 * component:  General => Rewrite Rules


Old description:

> Please, read carefully. (let's say, i already done: global $wp_rewrite );
>
> For example, i do REGISTER_POST_TYPE in functions.php.
>

> after registering, if i do
> {{{
> $wp_rewrite->flash_rules();
> }}}
>  only one time (not on every execution of functions.php, but only once in
> life[using example checkpoint], after registering that post type ), and
> when I debug $wp_rewrite:
>
> add_action('wp_head','myfunc');function myfunc(){
>    var_dump($wp_rewrite->wp_rewrite_rules());exit;
> }
>
> i see,that my Custom POST_TYPE is not shown.
>
> if i execute (once again,manually, from functions.php)
> {{{
> $wp_rewrite->flash_rules();
> }}}
>
> then in debug, it shows Well.
>
> then READ:
> if i remove REGISTER_POST_TYPE block from functions.php, and do
> flash_rules only once, then in debug, the old post_type data is still
> shown!
>
> i have to do flash_rules second time, and after that, it is removed ok.
>
> so, why double flash_rules are needed? i think, it's a bug.

New description:

 Please, read carefully. (let's say, i already done: global $wp_rewrite );

 For example, i do REGISTER_POST_TYPE in functions.php.


 after registering, if i do
 {{{
 $wp_rewrite->flash_rules();
 }}}
 only one time (not on every execution of functions.php, but only once in
 life[using example checkpoint], after registering that post type ), and
 when I debug $wp_rewrite:
 {{{
 add_action('wp_head','myfunc');function myfunc(){
    var_dump($wp_rewrite->wp_rewrite_rules());exit;
 }
 }}}
 i see,that my Custom POST_TYPE is not shown.

 if i execute (once again,manually, from functions.php)
 {{{
 $wp_rewrite->flash_rules();
 }}}

 then in debug, it shows Well.

 then READ:
 if i remove REGISTER_POST_TYPE block from functions.php, and do
 flash_rules only once, then in debug, the old post_type data is still
 shown!

 i have to do flash_rules second time, and after that, it is removed ok.

 so, why double flash_rules are needed? i think, it's a bug.

--

Comment:

 I think #30501 might have fixed that, could you test on 4.2-RC1?

 Also related: #18450.

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


More information about the wp-trac mailing list