I'm trying to setup two rewrite rules for two post types. Basically, the structure I want is this:
site.com/app/course/xxxx/
=> adds query_var course
site.com/app/course/xxxx/theme/xxxx/
=> adss query vars course and theme
I set up two add_rewrite_rule
:
public 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' );
}
If I add just the first rule, it works. If I only add the second rule, it works too. But, if I add both, only the first rule works. The second rule loads a valid page, but the theme var is not set.
Am I doing something wrong? Any tips are welcome!