Routing in WordPress
Instead of adding query_vars with add_rewrite_tag(), use the query_vars filter hook. I’ve used the following code to test your routing and it’s working just fine. class OP_Plugin { public function init() { add_action( ‘init’, array( $this, ‘add_rewrite_rules’ ) ); add_filter( ‘query_vars’, array( $this, ‘add_query_vars’ ) ); add_filter( ‘template_include’, array( $this, ‘add_template’ ) ); } public … Read more