WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to achieve the following permalink structure for a custom post type called "concept" with taxonomy "category"


Note: The main problem here is I don't want the custompost type slug /concept to appear, and now it seems to be conficting with existing rewrite rules

I did

global $wp_rewrite;
$concept_permalink_structure = '/%category%/%concept%/';
$wp_rewrite->add_rewrite_tag('%concept%/','([^/]+)', 'concept=');
$wp_rewrite->add_permastruct('concept/',$concept_permalink_structure,false );


add_filter('post_type_link', 'tt_concept_permalink2', 10,3);   

function tt_concept_permalink2($permalink, $post, $leavename ) {

    if($post->post_type != 'concept')
            return $permalink;

    if( !isset($post->ID) ){
        global $post;

    $categories = get_the_terms( $post->ID, 'category');

    if( is_array($categories) && count( $categories ) > 0 ) {
        $cat = $categories[key($categories)]->slug;
        $permalink = str_replace('concept/', $cat .'/', $permalink );

    return $permalink;


and it is working!


all other permalink( page, other custom post types ) are giving 404 error!

How can I make them work?

share|improve this question
I was in the same situation as you not long ago. I tried coding myself a solution, but found that the WP Permastructure plugin does the best job. Reputable developer as well – shea Aug 11 '13 at 8:05

Your Answer


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

Browse other questions tagged or ask your own question.