1

My permalink settings is simply /%postname%/ (yes I read from the codex that this is bad performance practice). The result is:

  • a page url might look like site.com/pagename
  • a blog post looks like site.com/post-title
  • a portfolio (custom post type) post will look like site.com/portfolio/item-1

I would like my blog post page (single.php) to have a URL like site.com/blog/post-title. How might I do that?

1 Answer 1

3

Change your permalink structure to /blog/%postname%/.

EDIT

To get your custom post type to leave out the /blog part, in its registration arguments array, set the rewrite argument like this:

'rewrite' => array( 'slug' => 'portfolio', 'with_front' => false )
1
  • It won't "fail", those CPTs will just have 'blog' at the beginning of their permastruct. That's totally expected behavior. You could also filter those post types' rewrite rules on the '{$post_type}_rewrite_rules' filter, removing '/blog' from the beginning of any rule regexes. Commented Mar 29, 2013 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.