why is are these rewrite_tags and rules not working?

Your rewriterules arn’t correct anymore. You changed add_rewrite_rule(‘^video/([^/]*)/([^/]*)/[^/]*)’, ‘index.php?pagename=video&video_id=$matches[1]&video_src=$matches[2]&video_title=$matches[3]’, ‘top’); To add_rewrite_rule(‘^video/([^/]*)/([^/]*)/[^/]*)’, ‘video/&video_id=$matches[1]&video_src=$matches[2]&video_title=$matches[3]’, ‘bottom’); The correct rewriterules for your pages are: Video add_rewrite_rule(‘^video/([^/]*)/([^/]*)/[^/]*)’, ‘index.php?pagename=video&video_id=$matches[1]&video_src=$matches[2]&video_title=$matches[3]’, ‘top’); Team add_rewrite_rule(‘^videos/team/([^/]*)/([^/]*)’, ‘index.php?pagename=videos&team_id=$matches[1]&team_slug=$matches[2]’, ‘top’); League add_rewrite_rule(‘^videos/league/([^/]*)/([^/]*)’, ‘index.php?pagename=videos&league_id=$matches[1]&league_slug=$matches[2]’, ‘top’); For team and league I assumed your WordPress page is “videos”. If it is the subpage then you have to change “pagename=videos” … Read more

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’);

Clean URLs for custom $_GET variables

You should look at “Rewrite Endpoints”, which are much simpler to work with than custom rewrites. And they fit your use case perfectly: http://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint You might add your “show” endpoint like so: function wpsx_37961_add_endpoints() { // Add the “show” rewrite endpoint to all URLs add_rewrite_endpoint(‘show’, EP_ALL); } add_action(‘init’,’wpsx_37961_add_endpoints’); Then you can check for its value … Read more

Cyrillic characters in rewrite rules cause 404 Not Found errors

I ended up following @Kolya Korobochkin advice and added uppercase and lowercase versions of the rewrite rules that include escaped octets. $regular_page_uri = get_page_uri( $page->ID ); $uppercase_page_uri = preg_replace_callback( ‘/%[0-9a-zA-Z]{2}/’, create_function( ‘$x’, ‘return strtoupper( $x[0] );’ ), $regular_page_uri ); The Percent Encode Capital Letter plugin uses a similar approach to convert the octets in every … Read more

Case-insensitive add_rewrite_rules in WordPress functions

As the answer below mentions, it is not possible to pass a flag to add_rewrite_rule(); however, it is possible to use an inline modifier. In your example, you would do this: $aNewRules = array(‘(?i)my-books/?$’ => ‘index.php?pagename=my-books’); (note the (?i) in the regular expression). The advantage of this approach is that your rewrite rules are much … Read more

WordPress Custom URL Rewrites

I do something similar with custom records called shops and their specific ID number. In my case I want http://example.com/shops/UNIDrecordthatsreallylong to load with the variable shop_unid being the UNID record. Here’s my working function: //Shop page rewrites function shop_rewrite() { add_rewrite_rule(‘^shops/([^/]*)/?’,’index.php?pagename=shops&shop_unid=$matches[1]’,’top’); add_rewrite_tag(‘%shop_unid%’,'([^&]+)’); } add_action(‘init’, ‘shop_rewrite’); Note that I used pagename instead of the post number. … Read more

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