Rewriting single post url; add_rewrite_rule problem?
Rewriting single post url; add_rewrite_rule problem?
Rewriting single post url; add_rewrite_rule problem?
Is your Blog page the one that’s set in the back end at Settings > Reading > Posts page? If so, try checking for that in your first function: /* Add .htm extension to Page URL Links */ add_action(‘init’, ‘htm_page_permalink’, -1); function htm_page_permalink() { global $post; if( get_option( ‘page_for_posts’ ) == $post->ID ) { // … Read more
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