0

I use both pages and blog posts on my site. Pages get the URL example.org/%postname%/, and based on Permalink settings, posts get the URL example.org/blog/%postname%/. Perfect.

I have a custom post type used by another group on my site for their web pages. In registering the post type, I have a rewrite slug for them: 'rewrite' => array('slug' => 'ncfpw'), However, their pages are getting the URL example.org/blog/ncfpw/%postname%/

How can I get rid of "blog" in their URLs? Somehow it seems Wordpress sees the custom post type as posts, not pages?

1 Answer 1

2

Somehow it seems Wordpress sees the custom post type as posts, not pages?

No, but your permalink structure (for the default post post type) that you set via the Permalink Settings admin page contains (or starts with) blog/ and by default, it will also be prepended to permalinks for custom post types, unless the post type sets the with_front argument to false.

Therefore,

How can I get rid of "blog" in their URLs?

Just set the with_front to false:

'rewrite' => array('slug' => 'ncfpw', 'with_front' => false),

And then flush the rewrite rules by simply visiting the Permalink Settings page.

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.