0

I want to prefix my blog posts with /news/ and changing my Permalinks to /news/%postname% seems to do the trick.

However, I also have a few custom post types and for some reason those URL's are now also prefixed with /news/. Of course this is not what I want.

How can I make sure that only the out-of-the-box Wordpress post type is prefixed with /news/?

2
  • why don't you create a category called News to mark your posts, and set the links to /%category%/%postname% ???? Commented Nov 20, 2011 at 5:41
  • Hmm. that seems to be a work around, albeit somewhat unclean. It's seems to be working though. Not sure yet how I feel about this solution in the long term.
    – Luke
    Commented Nov 20, 2011 at 5:51

1 Answer 1

1

Assuming that you are not using a plugin to handle your post types but are registering them manually:

Add the rewrite argument to your register_post_type() function calls.

$rewrite = array(
    'slug' => $slug,
    'with_front' => false
);

$args = array(
    // your other arguments
    'rewrite' => $rewrite
);

register_post_type( 'name_of_your_post_type', $args );

If your registering your post types with some plugin, check whether it has an option to set with_front to false. It defaults to true (unfortunately, for your sake).

Whether there's a plugin out there that has this feature I don't know - never used no post type plugin(s).

1
  • 'with_front' => false was exactly what I was looking for.
    – Luke
    Commented Nov 20, 2011 at 8:11

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.