Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#32023 closed defect (bug) (duplicate)

FOUND BUG - REWRITE_RULES need to be fired TWICE!

Reported by: selnomeria's profile selnomeria Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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.

Change History (3)

#1 @selnomeria
9 years ago

Similar tickets found here : #18594 #21824

Last edited 9 years ago by SergeyBiryukov (previous) (diff)

#2 @SergeyBiryukov
9 years ago

  • Component changed from General to Rewrite Rules
  • Description modified (diff)

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

Also related: #18450.

#3 @dd32
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Marking as a duplicate of #30501 based on limited information. If you can still reproduce this, feel free to re-open it.

Note: See TracTickets for help on using tickets.