• I have a client that used to have a static website and a blog powered from WordPress under the /blog subdirectory. Now he decided to move everything into WordPress so that he can also create and edit pages easily. However because the website is getting a lot of traffic and he already has likes, tweets and +1 in every blog post he wants to keep his blog under the website.com/blog. I thought it was as easy as heading over the permalinks and add /blog/%postname%/ in the permalink structure.

    What the problem is right now is that I have a created a few custom post types to accommodate the needs of his content and custom post type’s content resides now under the blog virtual directory.

    How can I specify that only the blog posts and the blog categories must be under the /blog virtual directory and everything else can use the permalink structure of /%postname%/.

    [No bumping. If it’s that urgent, consider hiring someone.]

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m trying to achieve the exact same thing….tried everything I can think of….seems that it works if you don’t use a custom permalink (in our case, we are using /blog/%postname)….if you select one of the radio button options in the permalinks settings page, your custom post types will be how we want them e.g. domain.com/custom-post-type.

    Guess I’ll keep googling…would love someone to chime in ??

    I also search soulotion for this problem. I think this option need to be default on wordpress.

    I want to stay with default permalinks but to add prefix /blog/ before only for the posts but for the pages to use pretty permalinks

    Thread Starter nikoza

    (@nikoza)

    Hey guys,

    After searching and trying several things the solution end up being.

    Head over to general permalinks and add the blog prefix to your permalink structure. Then go to your plugin or functions.php file where you register the post type and add the following:

    ‘rewrite’ => array(‘with_front’ => false, ‘slug’ => ‘your-slug’).

    That will keep the custom post types under the domain. Remember to do the same for the custom taxonomies you register. Initally I thought it was the custom post type that was causing the problem but it was the taxonomy that was causing it.

    If you need anything else just ask!

    nikoza’s code works perfectly. just replace “your-slug” with the correct slug for the post type. thanks.

    10 months later, I just searched this again haha

    Thanks very much for the solution Nikoza, works perfectly.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to remove /blog/ prefix for custom post types in permalinks?’ is closed to new replies.