Changing slug of all posts

Change the Permalinks structure as you mentioned, but also add (or change) the following line for all the other CPTs: $rewrite->with_front=”false”; Setting with_front to false will strip off whatever prefix you have listed in your Permalink settings. If setting that up and hitting the Permalinks page to flush rewrite rules doesn’t immediately fix the problem, … Read more

Is there a way to create two template for single custom post type page?

I think you need to work on thetemplate_include hook. https://developer.wordpress.org/reference/hooks/template_include At this point you can add a condition and returning the correct template path add_filter( ‘template_include’, ‘redirect_single’ ); function redirect_single( $template ){ if($_POST[‘template’] == ‘gallery’) { $template = path/to/your/template; }elseif($_POST[‘template’] == ‘other’){ $template = path/to/your/template; } return $template; }

Custom Post Type posts, conflict with posts after add_rewrite_rule to top

I think I solved my problem. So if you have your WordPress post permalink set to %category%/%postname%/, and you want this for custom post type and taxonomy, you could prepare your rewrite links for all generated taxonomy terms (cat-a, cat-b etc.). Code: add_filter( ‘rewrite_rules_array’, function($rules) { $categories = get_terms([‘taxonomy’ => ‘success-category’ ]); foreach ($categories as … Read more

Postname on unique permalink structure appends “-2” for a custom post type. How can I get this to stop happening?

By default, WordPress disallow 2 identical slugs because if you change your permalink structure for custom structure, you should be able to have in your case: https://example.com/saint-louis/ https://example.com/saint-louis/ And you can understand, it’s impossible. The only way is checking by code, you are not in “custom structure” and then save in db with the WordPress … Read more