Skip to content

Instantly share code, notes, and snippets.

@diegoliv
Created March 9, 2016 00:05
Show Gist options
  • Save diegoliv/09d1b22ea8aa9a6ad83f to your computer and use it in GitHub Desktop.
Save diegoliv/09d1b22ea8aa9a6ad83f to your computer and use it in GitHub Desktop.
Rewrite Rules issue - how to make both work?
<?php
function rewrite_rules(){
add_rewrite_tag( '%course%', '([^&]+)' );
add_rewrite_tag( '%theme%', '([^&]+)' );
add_rewrite_rule("^app/course/([^/]+)/?",'index.php?page_id=3400&course=matches[1]', 'top' );
add_rewrite_rule('^app/course/([^/]+)/theme/([^/]+)/?','index.php?page_id=3400&course=$matches[1]&theme=$matches[2]', 'top' );
}
add_action( 'init', 'rewrite_rules' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment