0

I've created a custom taxonomy for posts using

register_taxonomy( 
    'discipline', 
    array('post'), /* if you change the name of register_post_type( 'custom_type', then you have to change this */
    array(
        'hierarchical' => true,     /* if this is true it acts like categories */             
        'labels' => array(
            'name' => __( 'Disciplines' ), /* name of the custom taxonomy */
            'singular_name' => __( 'Discipline' ), /* single taxonomy name */
            'search_items' =>  __( 'Search Disciplines' ), /* search title for taxomony */
            'all_items' => __( 'All Disciplines' ), /* all title for taxonomies */
            'parent_item' => __( 'Parent Discipline' ), /* parent title for taxonomy */
            'parent_item_colon' => __( 'Parent Discipline:' ), /* parent taxonomy title */
            'edit_item' => __( 'Edit Discipline' ), /* edit custom taxonomy title */
            'update_item' => __( 'Update Discipline' ), /* update title for taxonomy */
            'add_new_item' => __( 'Add New Discipline' ), /* add new title for taxonomy */
            'new_item_name' => __( 'New Discipline Name' ) /* name title for taxonomy */
        ),
        'rewrite' => array(
            'slug' => 'discipline',
            'with_front' => false
        ),
        'show_ui' => true,
        'query_var' => true,
    )
);

If I use just %postname% in the permalinks page, I get URLs like:

whatever.com/discipline/name-of-post

I want to get the URL to read

whatever.com/parent-term-name/name-of-post

I've removed the discipline part using the "Remove Taxonomy Base Slug" plugin but can't figure out how to get the term name included AND have permalinks to other parts of the site unaffected.

1 Answer 1

0

I think you need to include the discipline variable in the custom permalink structure

/%discipline%/%postname%
2
  • I tried that, it doesn't get replaced with the actual term name. My urls just contain the phrase 'discipline'! Commented Aug 18, 2014 at 12:57
  • Did you flush the permalinks after registering the taxonomy? Go to Settings>Permalinks and click save. Commented Aug 18, 2014 at 15:19

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.