Remove base slug in CPT & CT, use CT in permalink

I copied your code as-is above, pasted it into the twentysixteen theme, and changed just the post type rewrite slug from review/%brand% to %brand%. This resulted in both the term archive and review posts having your desired URL structure and successfully displaying. Now the bad news is that the rewrite rules generated for the taxonomy … Read more

WordPress monthly archive links result in 404

It looks like you need to add your news custom post type to the query for archive pages (I had the same problem). Codex: custom post types to query Add this code to your functions // Show posts of ‘post’, and ‘news’ post types on archive page add_action( ‘pre_get_posts’, ‘add_my_post_types_to_query’ ); function add_my_post_types_to_query( $query ) … Read more

Custom Post Type pagination when CPT ‘rewrite’ rule and a page have the same slug

Try changing the page’s slug to something else and changing your post type registration to this: $args = array( ‘labels’ => $labels, ‘public’ => true, ‘publicly_queryable’ => true, ‘has_archive’ => true, ‘show_ui’ => true, ‘rewrite’ => array(‘slug’ => ‘properties’, ‘with_front’ => false), ‘query_var’ => true, ‘capability_type’ => ‘post’, ‘hierarchical’ => false, ‘show_in_nav_menus’ => false, ‘menu_position’ … Read more

Need help with complex custom post type setup

Ok, that is complicated 🙂 Have you considered using rewrite endpoints? I would not try and cram everything into the url unless you have a specific need or a requirement for that. domain/<series>/<episode-name> would be going directly to the episode CPT domain/cartoon-series/<series> – would go the the series CPT Then using rewrite endpoints to have … Read more

Rewrite Rule for Post “Subpage”, with pagination

After more research on url-rewriting add-rewrite-rule and rewrite-rules I got introduced to Redirect Canonical Redirects incoming links to the proper URL based on the site url. Search engines consider www.somedomain.com and somedomain.com to be two different URLs when they both go to the same location. This SEO enhancement prevents penalty for duplicate content by redirecting … Read more

Dynamic URL, not a physical page within the database

add_rewrite_rule can help you sniff the request and let you handle it however you want. if( ! class_exists(‘PropertiesEndpoint’)): class PropertiesEndpoint { // WordPress hooks public function init() { add_filter(‘query_vars’, array($this, ‘add_query_vars’), 0); add_action(‘parse_request’, array($this, ‘sniff_requests’), 0); add_action(‘init’, array($this, ‘add_endpoint’), 0); } // Add public query vars public function add_query_vars($vars) { $vars[] = ‘__properties’; $vars[] = … Read more

add_rewrite_rule again

Here’s an example with template_redirect that loads your php script if the prm1 query var is set: // set up the rewrite add_action( ‘init’, ‘wpse36736_setup_rewrites’ ); function wpse36736_setup_rewrites(){ add_rewrite_rule( ‘snpv/([^/]+)’, ‘index.php?prm1=$matches[1]’, ‘top’ ); } // add query var add_filter(‘query_vars’, ‘wpse36736_query_vars’); function wpse36736_query_vars( $query_vars ){ $query_vars[] = ‘prm1’; return $query_vars; } // check the query var … Read more

How to debug removal of rewrite rule flushing?

To see if the option ‘rewrite_rules’ was reset – that’s what flush_rewrite_rules() does internally – hook into the option actions and log what happens. The following small plugin does that. It will tell you what code flushed the rewrite rules and how the rules looked before and after the flush. If no flush happened it … Read more

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