Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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 )
share|improve this answer
    
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. –  John P Bloch Mar 29 '13 at 15:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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