Making extra parameters optional

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 do I flush rewrite rules

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)