I would like to turn /{custom-post-type}/{post-name} to /{post-name}, is this possible?
If this is not possible, can I change the labels/terminology in Pages or Posts so that they could be called “Clients” or “Projects” etc?
I would like to turn /{custom-post-type}/{post-name} to /{post-name}, is this possible?
If this is not possible, can I change the labels/terminology in Pages or Posts so that they could be called “Clients” or “Projects” etc?
You must be logged in to post a comment.
You need to use option
'rewrite'
in your custom post type registration.E.g.
'rewrite' => array('slug' => 'products'),
From the codex
This will get the url correctly formed for you, but it will 404 unless you handle it in your theme.
I just changed a slug for a custom post type (in this case, I changed it from
"best-practices"
to"bestpractices"
). I had copied some code that had a blank slug, like so:Since it was originally left blank, WordPress was just using the name of the custom post type (
"best-practices"
) as the slug. I changed my line of code toI just wanted to note here that you’ll need to reset your permalinks to get the change to take effect, if you’re changing slugs on pre-existing custom post types.
yes, we can change the slug. Please follow the steps:
Step 1: Change the slug name from the option “rewrite”. (located at Theme Functions (functions.php))
‘rewrite’ => array(‘slug’ => ‘products’)
Step 2: Reset the permanent link. Otherwise, it will give 404 error.
1> goto wp dashboard.
2> Setting –> Permalinks
Under the common setting section—
1st change it to plain and save it.
After that, again change the setting as your preferred format.