How to pass url as a parameter in a add_rewrite_rule
How to pass url as a parameter in a add_rewrite_rule
How to pass url as a parameter in a add_rewrite_rule
htaccess problem not being able to overwrite previous rules
I’ve probably found the solution for the above problem. To pre-populate the global variable $wp_query you have to run the query_posts() function with the correct arguments and reset the $wp_query->post with the function wp_reset_postdata(). This must be done on the template_redirect hook or earlier. class Webeo_Download { protected $downloadId; protected $action; public function setup() { … Read more
URL Rewrite and add_query_var not working
Rewrites with hierarchical taxonomies in permalink
Specific routing for CPT
Get url.com/post_type/taxonomy/term work!
Custom post types can not use the “day/name” permalink structure defined in WordPress permalinks settings. You need to add your own rewrite rules to fit your needs. For example: add_action(‘init’,’my_rewrite_rules’); function my_rewrite_rules(){ // Replace custom_post_type_slug with the slug of your custom post type add_rewrite_rule( ‘custom_post_type_slug/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(.+)/?$’, ‘index.php?custom_post_type_slug=’.$matches[4], ‘top’ ); } Note that I’ve not tested the … Read more
Try this and follow the same structure to add more rewrite rules or query vars: add_filter(‘query_vars’, ‘my_query_vars’); function my_query_vars( $vars) { $vars[] = “land”; $vars[] = “expert”; return $vars; } // Add the new rewrite rule to existings ones add_action(‘init’,’my_rewrite_rules’); function my_rewrite_rules() { add_rewrite_rule( ‘land/(.+)/?$’ , ‘index.php?land=1&expert=$matches[1]’ , ‘top’ ); } Don’t forget to flush … Read more
Pretty URLs and custom post types