Change Permalink Structure for Tag.php template

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

Read More

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?

Related posts

1 comment

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

Comments are closed.