wordpress add_rewrite_rule not working
wordpress add_rewrite_rule not working
wordpress add_rewrite_rule not working
Rewrite rule for path of favicon.ico ( Add_rewrite_rule function possible ? )
Solved. Nginx and WordPress were acting correctly. There was an error condition further down my request processing code.
Two points: Your rule isn’t particularly specific. For numeric matches you should be specific about it and specify a) digits and b) how many digits. Year would be ([0-9]{4}), month/day would be ([0-9]{1,2}). You can’t do it with one rule. Add three separate rules instead. add_rewrite_rule( ‘whats-on/([0-9]{4})/?$’, ‘index.php?page_id=71&event_year=$matches[1]’,’top’); add_rewrite_rule( ‘whats-on/([0-9]{4})/([0-9]{1,2})/?$’, ‘index.php?page_id=71&event_year=$matches[1]&event_month=$matches[2]’,’top’); add_rewrite_rule( ‘whats-on/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$’, ‘index.php?page_id=71&event_year=$matches[1]&event_month=$matches[2]&event_day=$matches[3]’,’top’);
How to add rewrite rule for external php file
add_rewrite_rule permalinks break in WordPress 4.5
rewrite url in wordpress
Pass query vars to front page
add_rewrite_rule redirects if value = 1
I haven’t worked much with flush_rewrite_rules function, but based on the usage notes mention by nmr I think you could perhaps do something like this, add_action( ‘save_post’, ‘my_save_post_function’ ); function my_save_post_function( $post_id ) { $maybe_some_extra_logic = true; // if applicable if ( $maybe_some_extra_logic && ! has_action( ‘shutdown’, ‘my_flush_rewrite_rules’ ) ) { add_action( ‘shutdown’, ‘my_flush_rewrite_rules’, 9999 … Read more