I’ve a custom post type by name ‘Portfolio’. It’s generating the url as /portfolio/xxx when I make any post. I want to change it to ‘Products’.
Change custom post-type rewrite
I’ve tried this but it doesn’t suppose to work.
Leave a Reply
You must be logged in to post a comment.
I am presuming you have added the custom post type yourself, in which case it is easy.
When you register a new post type, you can set any rewrite rules for that post type to follow as part of the arguments used in the
register_post_type( 'name', $args )
function.If your post type is available on the front end and is public, then by default WordPress will use the custom post name as the slug. You can override this as follows:
The other arguments you can use are documented at http://codex.wordpress.org/Function_Reference/register_post_type
Please see the documentation on URLs of Namespaced Custom Post Types Identifiers. One of the options available to you is to add a
'rewrite'
argument to register_post_type(). From the docs:You’ll then likely need to login to the admin and re-save your permalinks.
Use the rewrite property