Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have 3 taxonomies bundled with my custom post type. I have noticed my custom post type(cpt) and 2 taxonomies won't show in the Wordpress menu system but 1 taxonomy will. Can anyone point me in the right direction to get the one taxonomy to not be on the menu but get the cpt to show in the menu with a link just to the post type page?

Here is my code. From what I can see, all the taxonomies seem the same to me except for the obvious differences to make them different.

<?php
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Register Custom Post Type for Sermons
function ssum_sermon_cpt_init() {

    $labels = array(
        'name'                => _x( 'Sermons', 'Post Type General Name' ),
        'singular_name'       => _x( 'Sermon', 'Post Type Singular Name' ),
        'menu_name'           => __( 'Sermons' ),
        'parent_item_colon'   => __( 'Parent Sermon' ),
        'all_items'           => __( 'All Sermons' ),
        'view_item'           => __( 'View Sermon' ),
        'add_new_item'        => __( 'Add New Sermon' ),
        'add_new'             => __( 'New Sermon', 'sermons' ),
        'edit_item'           => __( 'Edit Sermon' ),
        'update_item'         => __( 'Update Sermon' ),
        'search_items'        => __( 'Search sermons' ),
        'not_found'           => __( 'No sermons found' ),
        'not_found_in_trash'  => __( 'No sermons found in Trash' ),
    );
    $args = array(
        'label'               => __( 'sermons' ),
        'description'         => __( 'Displays sermon information' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'editor' ),
        'taxonomies'          => array( 'speaker', 'service', 'year' ),
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_admin_bar'   => true,
        'show_in_nav_menus'   => false,
        'query_var'           => true,
        'menu_position'       => 25,
        'menu_icon'           => 'dashicons-format-audio',
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'rewrite'             => array(
            'slug' => 'sermons',
            'with_front' => false
        ),
    );
    register_post_type( 'sermons', $args );
}

// Hook into the 'init' action
add_action( 'init', 'ssum_sermon_cpt_init', 0 );


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Register Custom Taxonomy for Service Times
function ssum_service_ct_init() {

    $labels = array(
        'name'                       => _x( 'Services', 'Taxonomy General Name' ),
        'singular_name'              => _x( 'Service', 'Taxonomy Singular Name' ),
        'menu_name'                  => __( 'Service' ),
        'all_items'                  => __( 'All Services' ),
        'new_item_name'              => __( 'New Service Name' ),
        'add_new_item'               => __( 'Add New Service' ),
        'edit_item'                  => __( 'Edit Service' ),
        'update_item'                => __( 'Update Service' ),
        'separate_items_with_commas' => __( 'Separate services with commas' ),
        'search_items'               => __( 'Search services' ),
        'add_or_remove_items'        => __( 'Add or remove services' ),
        'choose_from_most_used'      => __( 'Choose from the most used services' ),
    );
    $args = array(
        'labels'                     => $labels,
        'hierarchical'               => false,
        'public'                     => true,
        'show_ui'                    => true,
        'show_admin_column'          => true,
        'show_in_nav_menus'          => true,
        'show_tagcloud'              => true,
        'query_var'                  => 'service',
    );
    register_taxonomy( 'service', 'sermons', $args );

}

// Hook into the 'init' action
add_action( 'init', 'ssum_service_ct_init', 0 );

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Register Custom Taxonomy for Speakers
function ssum_speaker_ct_init() {

    $labels = array(
        'name'                       => _x( 'Speakers', 'Taxonomy General Name' ),
        'singular_name'              => _x( 'Speaker', 'Taxonomy Singular Name' ),
        'menu_name'                  => __( 'Speaker' ),
        'all_items'                  => __( 'All Speakers' ),
        'new_item_name'              => __( 'New Speaker Name' ),
        'add_new_item'               => __( 'Add New Speaker' ),
        'edit_item'                  => __( 'Edit Speaker' ),
        'update_item'                => __( 'Update Speaker' ),
        'separate_items_with_commas' => __( 'Separate speakers with commas' ),
        'search_items'               => __( 'Search speakers' ),
        'add_or_remove_items'        => __( 'Add or remove speakers' ),
        'choose_from_most_used'      => __( 'Choose from the most used speakers' ),
    );
    $args = array(
        'labels'                     => $labels,
        'hierarchical'               => false,
        'public'                     => true,
        'show_ui'                    => true,
        'show_admin_column'          => true,
        'show_in_nav_menus'          => true,
        'show_tagcloud'              => true,
        'query_var'                  => 'speaker',
    );
    register_taxonomy( 'speaker', 'sermons', $args );

}

// Hook into the 'init' action
add_action( 'init', 'ssum_speaker_ct_init', 0 );

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Register Custom Taxonomy
function ssum_year_ct_init() {

    $labels = array(
        'name'                       => 'Years',
        'singular_name'              => 'Year',
        'menu_name'                  => 'Years',
        'all_items'                  => 'All Years',
        'new_item_name'              => 'New Sermon Year',
        'add_new_item'               => 'Add New Year',
        'edit_item'                  => 'Edit Year',
        'update_item'                => 'Update Year',
        'separate_items_with_commas' => 'Separate years with commas',
        'search_items'               => 'Search Years',
        'add_or_remove_items'        => 'Add or remove years',
        'choose_from_most_used'      => 'Choose from the most used years',
        'not_found'                  => 'Year Not Found',
    );
    $args = array(
        'labels'                     => $labels,
        'hierarchical'               => false,
        'public'                     => true,
        'show_ui'                    => true,
        'show_admin_column'          => true,
        'show_in_nav_menus'          => true,
        'show_tagcloud'              => true,
        'query_var'                  => 'year',
    );
    register_taxonomy( 'year', 'sermons', $args );

}

// Hook into the 'init' action
add_action( 'init', 'ssum_year_ct_init', 0 );

The Year taxonomy is the one that shows up in the menu system. I want to get it out of the menu like the others but add the cpt link to the menu. In this case that would be 'example.com/sermons'

share|improve this question
    
Make sure they are checked in the screen options on the top right side of the menu edit screen. –  Bainternet Jan 21 at 8:05
    
@bainternet years was checked there. Why would one be automatically checked and the others not be? Also, do you have any insight on adding a link to the custom post type slug to the menu on plugin install? –  Blaine Huff Jan 21 at 21:15
    
not sure, and as for the slug thing just ask another question. –  Bainternet Jan 22 at 9:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.