Custom Post Types using wrong template (index) instead of archive-{type}.php – previously worked as expected

The issue was, in fact, the new taxonomy using “year” clashes with the query. WordPress was accepting year=about-us in the query chain for instance, as year was a taxonomy, before the expected page=about-us – preventing it from appearing as a page and using the index.php template as there is no “year” template. I changed year … Read more

How to change custom post type slug without damage seo? [closed]

You can do this without losing SEO. Change the taxonomy slug from “watches-product” to “watches/product” register_taxonomy(‘wpsc_watch_product_category’, ‘wpsc_watch_product’, array( ‘hierarchical’ => true, ‘query_var’ => ‘watch_product_category’, ‘rewrite’ => array( ‘slug’ => ‘watches/product’ ), ‘labels’ => $labels, )); Install a 302 Redirect Plugin. This plugin will redirect all the traffic to new url.

Can I have a specific template for products even if they are standard posts and not CPT?

Filter template_include, check if the current post is a product and load the product template. Example: add_filter( ‘template_include’, function( $template ) { if ( ! is_singular() or ! get_post_meta( get_the_ID(), ‘price’, true ) ) return $template; return locate_template( ‘product-single.php’ ); }); How exactly you determine if a post is a product is up to your … Read more