I have my custom post type set up with hierarchicy set to true and the url works like: Lions News › S1 › Test Post 1 which is nice except that it should go one futher and be like Lions Minis › Lions News › S1 › Test Post 1 Lions Minis being the parent page to everything. Is there a way to to set that up?

The following is my setup in functions.php

/** Custom Post Types for Lions News */
 $labels = array(
'name'                          => 'Lions News Categories',
'singular_name'                 => 'Lions Category',
'search_items'                  => 'Search Lions Categories',
'popular_items'                 => 'Popular Lions Categories',
'all_items'                     => 'All Lions Categories',
'parent_item'                   => 'Parent Lions Category',
'edit_item'                     => 'Edit Lions Category',
'update_item'                   => 'Update Lions Category',
'add_new_item'                  => 'Add New Lions Category',
'new_item_name'                 => 'New Lions Category',
'separate_items_with_commas'    => 'Separate Lions Categories with commas',
'add_or_remove_items'           => 'Add or remove Lions Categories',
'choose_from_most_used'         => 'Choose from most used Lions Categories'
);

$args = array(
'label'                         => 'Lions Categories',
'labels'                        => $labels,
'public'                        => true,
'hierarchical'                  => true,
'show_ui'                       => true,
'show_in_nav_menus'             => true,
'args'                          => array( 'orderby' => 'term_order' ),
'rewrite'                       => array( 'slug' => 'lions_news/lions_articles', 'with_front' => false ),
'query_var'                     => true
);

register_taxonomy( 'lions_articles', 'lions_news', $args );

register_post_type( 'lions_news', 
array(
    'labels'                => array(
        'name'              => __( 'Lions News' ),
        'singular_name'     => __( 'Lions News' )
        ),
    'public'                => true,
    'show_ui'               => true,
    'show_in_menu'          => true,
    'supports'              => array( 'title','editor','thumbnail','comments','revisions' ),
    'rewrite'               => array( 'slug' => 'lions_news', 'with_front' => false ),
    'has_archive'           => true
)
);
/** End custom Post Types */

Thanks!

3 Answers
3

you should just be able to change this line

'rewrite' => array( 'slug' => 'lions_minis/lions_news', 'with_front' => false ),

Remember to always visit the Settings->Permalinks menu in wordpress after making a rewrite change for it to update the links!

Leave a Reply

Your email address will not be published. Required fields are marked *