0

I make a custom post type and a custom taxonomy for that but the template of my custom taxonomy return error 404 , for example local/mywebsite/people/catea show error 404.

function web_people()
{
        $labels = array(
            'name' => _x('people', 'Post Type General Name', 'fabthemes'),
            'singular_name' => _x('people', 'Post Type Singular Name', 'fabthemes'),
            'menu_name' => __('people', 'fabthemes'),
            'name_admin_bar' => __('people', 'fabthemes'),
            'archives' => __('archive item', 'fabthemes'),
            'parent_item_colon' => __('parent:', 'fabthemes'),
            'all_items' => __('all items', 'fabthemes'),
            'add_new_item' => __('add new item', 'fabthemes'),
            'add_new' => __('add', 'fabthemes'),
            'new_item' => __('new item', 'fabthemes'),
            'edit_item' => __('change item', 'fabthemes'),
            'update_item' => __('upgrade item', 'fabthemes'),
            'view_item' => __('show item', 'fabthemes'),
            'search_items' => __('search item', 'fabthemes'),
            'not_found' => __('not found', 'fabthemes'),
            'not_found_in_trash' => __('noting in recyclebin', 'fabthemes'),
            'featured_image' => __('thumbnail', 'fabthemes'),
            'set_featured_image' => __('set thumbnail', 'fabthemes'),
            'remove_featured_image' => __('remove thumbnail', 'fabthemes'),
            'use_featured_image' => __('add thumbnail', 'fabthemes'),
            'insert_into_item' => __('Insert into item', 'fabthemes'),
            'uploaded_to_this_item' => __('upgrade', 'fabthemes'),
            'items_list' => __('items list', 'fabthemes'),
            'items_list_navigation' => __('condition of list item', 'fabthemes'),
            'filter_items_list' => __('filter list of items', 'fabthemes'),
        );
    $args = array(
        'label' => __('people', 'fabthemes'),
        'description' => __('people items', 'fabthemes'),
        'labels' => $labels,
        'supports' => array('title', 'thumbnail',),
        'hierarchical' => false,
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'menu_position' => 5,
        'menu_icon' => 'dashicons-megaphone',
        'show_in_admin_bar' => true,
        'show_in_nav_menus' => true,
        'can_export' => true,
        'has_archive' => true,
        'exclude_from_search' => false,
        'publicly_queryable' => true,
        'capability_type' => 'page',
    );
    register_taxonomy(
        'peoplecat',
        'people',  // this is the custom post type(s) I want to use this taxonomy for
        array(
            'hierarchical' => true,
            'label' => 'category people',
            'query_var' => true,
            'rewrite' => array('slug' => 'peoples'),
            'show_admin_column' => true
        )
    );
    register_taxonomy_for_object_type('peoplecat', 'people');
    register_post_type('people', $args);
}
add_action('init', 'web_people', 0);
  • Is catea a category or post? Also, make sure you've re-saved your permalink settings (Settings > Permalinks). – Jacob Peattie Jan 6 at 6:19
  • @Jacob Peattie thanks man ! that is correct. – Amin.A Jan 6 at 6:22

Your Answer

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

Browse other questions tagged or ask your own question.