1

Im using a custom post type to build a filterable gallery and taking advantage of the tags taxonomy within it. I am also using a custom taxonomy called years.

at the moment, the permalink structure of the gallery page is www.example.com/gallery

it is filtered by tags and years. i have made a taxonomoy-years.php template and used

'rewrite' => array('slug' => 'archive/projects', 'with_front' => false)

to change the permalink structure from www.example.com/years/2000 to www.example.com/archive/projects/2000 when you filter using years.

When i filter using tags, its running off a the tag.php template, so the permalink structure is www.example.com/tag/studentwork but i would like it to be www.example.com/archive/tag/studentwork.

This is the code that defines my custom post type:

function add_post_type($name){

    add_action('init', function() use($name)  {

    register_post_type($name,array(
        'public' => true,
        'label' => ucwords($name),
        'labels' => array(
            'add_new_item' => "Add new $name item",
            'edit_item' => "Edit $name item"
        ),
        'supports' => array('title', 'editor', 'excerpt', 'comments', 'thumbnail'),
        'taxonomies' => array('post_tag'),


    ));
});

}

Can anybody help?

  • You shouldn't define a function with a name as generic as add_post_type(). Add a prefix to it, like for e.g.: wpse_add_post_type(). – kaiser Jun 23 '13 at 12:08
  • thanks but this dosent answer my question at all. – RoseCoder Jun 23 '13 at 14:30
  • That's why it's a comment and no answer... – kaiser Jun 23 '13 at 14:38
2

In Admin, go to Settings > Permalinks and under Tag Base add archive/tag.

  • Amazing, never even paid attention to that, thank you SO much!!! :) – RoseCoder Jun 23 '13 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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