Remove unwanted part of permalink custom structure from CPT url?

My site currently has regular posts (in a section called “Trend Watch”), as well as a Custom Taxonomy (called “Region”).

My permalink settings have this Custom Structure:

Read More
/trend-watch/%year%/%monthnum%/%postname%/

which gives me these urls:

  • /trend-watch/regions/ (lists all terms in the Regions taxonomy)
  • /trend-watch/regions/europe/ (lists all posts with the term
    “europe” in the Regions taxonmy).
  • /trend-watch/2011/03/an-interesting-article/ (a single post).

But now i’m adding a new Custom Post Type, called Reports. When registering this CPT, I set rewrite => array('slug' => 'reports'). But the urls are including “trend-watch/” first:

/trend-watch/reports/some-report/

How can I remove “trend-watch/” from the Reports CPT urls, but keep it for regular Posts (and the associated Custom Taxonomies).

Related posts

Leave a Reply

1 comment

  1. You need to set the ‘with_front’ parameter in the rewrite argument for the custom post type to false.

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