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

Rewrite rule for post as a child of a CPT

In addition to setting has_archive you need to set rewrite when you define the CPT. I replaced $archives because your code snippet does not have it defined. $rewrite = array(‘slug’ => ‘my-cpt-type’, ‘with_front’ => false); $download_args = array( ‘labels’ => $labels, ‘public’ => true, ‘publicly_queryable’=> true, ‘show_ui’ => true, ‘show_in_menu’ => true, ‘query_var’ => true, … Read more

Display categorised url

O’ I got it from godaddy.com. A blank page should be made first with the name SOMETHING1. Open the desired page, say New_Page. Open Page Attributes on the right side and select SOMETHNG1 from the Parent dropdown. This will create the permalink like this: domain/SOMETHING1/New_Page. The same procedure can be done in case of other … Read more

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