Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress Custom Post Type - Same Post Name, Different Post Type
    text
    copied!<p>I have 4 Custom Post Types:</p> <p>Services FAQs Prices Before and After</p> <p>I want to be able to have the same post names within each of these post types, example:</p> <blockquote> <p>Services<br> Skin (example.com/Services/skin)<br> Cream (example.com/Services/cream)<br> Body (example.com/Services/body)</p> <p>FAQs<br> Skin (example.com/FAQs/skin)<br> Cream (example.com/FAQs/cream)<br> Body (example.com/FAQs/body)</p> <p>Prices<br> Skin (example.com/Prices/skin)<br> Cream (example.com/Prices/cream)<br> Body (example.com/Prices/body)</p> <p>Before and After<br> Skin (example.com/before-and-after/skin)<br> Cream (example.com/before-and-after/cream)<br> Body (example.com/before-and-after/body)</p> </blockquote> <p>How can I do this? Right now if I make a new post with the same name as a current one, it adds a "-2" or "-3" to the end of the posts slug:</p> <p>BAD: </p> <blockquote> <p>example.com/services/body</p> <p>example.com/faqs/body-2</p> <p>example.com/prices/body-3 </p> <p>example.com/before-and-after/body-4</p> </blockquote> <p>SOMEONE PLEASE HELP!!!!!</p> <pre><code>add_action('init', 'create_post_type_html5'); // Add our HTML5 Blank Custom Post Type function create_post_type_html5() { register_taxonomy_for_object_type('category', 'html5-blank'); // Register Taxonomies for Category register_taxonomy_for_object_type('post_tag', 'html5-blank'); register_post_type('html5-blank', // Register Custom Post Type array( 'labels' =&gt; array( 'name' =&gt; __('Services', 'html5blank'), // Rename these to suit 'singular_name' =&gt; __('Services', 'html5blank'), 'add_new' =&gt; __('Add New', 'html5blank'), 'add_new_item' =&gt; __('Add New Services', 'html5blank'), 'edit' =&gt; __('Edit', 'html5blank'), 'edit_item' =&gt; __('Edit Services', 'html5blank'), 'new_item' =&gt; __('New Services', 'html5blank'), 'view' =&gt; __('View Services', 'html5blank'), 'view_item' =&gt; __('View Services', 'html5blank'), 'search_items' =&gt; __('Search Services', 'html5blank'), 'not_found' =&gt; __('No Servicess found', 'html5blank'), 'not_found_in_trash' =&gt; __('No Service\'s found in Trash', 'html5blank') ), 'rewrite' =&gt; array('slug' =&gt; 'service','with_front' =&gt; true), 'public' =&gt; true, 'hierarchical' =&gt; true, // Allows your posts to behave like Hierarchy Pages 'has_archive' =&gt; true, 'supports' =&gt; array( 'title', 'editor', 'excerpt', 'thumbnail' ), // Go to Dashboard Custom HTML5 Blank post for supports 'can_export' =&gt; true, // Allows export in Tools &gt; Export 'taxonomies' =&gt; array( 'post_tag', 'category' ) // Add Category and Post Tags support )); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload