2
votes

I have registered a custom post type and would like to add entries of this CPT into my menu. I have multiple users with the Admin Role, but they only show up under one specific user - the others simply don't see the Custom Post Types.

// functions.php
function register_cpt_trainings() {

    $labels = array(
        'name'                => _x( 'Trainings', 'Post Type General Name', 'somedomain' ),
        'singular_name'       => _x( 'Training', 'Post Type Singular Name', 'somedomain' ),
        'menu_name'           => __( 'Trainings', 'somedomain' ),
        'parent_item_colon'   => __( 'Eltern Training:', 'somedomain' ),
        'all_items'           => __( 'Alle Trainings', 'somedomain' ),
        'view_item'           => __( 'Training anzeigen', 'somedomain' ),
        'add_new_item'        => __( 'Training hinzufügen', 'somedomain' ),
        'add_new'             => __( 'hinzufügen', 'somedomain' ),
        'edit_item'           => __( 'Training bearbeiten', 'somedomain' ),
        'update_item'         => __( 'Training aktualisieren', 'somedomain' ),
        'search_items'        => __( 'Durchsuche Trainings', 'somedomain' ),
        'not_found'           => __( 'Nicht gefunden', 'somedomain' ),
        'not_found_in_trash'  => __( 'Nicht im Papierkorb gefunden', 'somedomain' ),
    );
    $args = array(
        'label'               => __( 'trainings', 'somedomain' ),
        'description'         => __( 'Trainings', 'somedomain' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'editor', ),
        'taxonomies'          => array( 'category' ),
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 5,
        'can_export'          => true,
        'has_archive'         => false,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'page'
    );
    register_post_type( 'trainings', $args );
}

Unter Design / Menu, I expect them to show up on all admin users, but the other ones only have the default entries "posts", "page", "links" and "categories".

My user also has the "training".

Any ideas?

1
add this in you function.php file add_action( 'init', 'register_cpt_trainings' ); - Shravan Sharma
@ShravanShrama The trainings do show up at all admin users in the menu bar - however, they do not show up unter the "Design" / "Menu" as an option for all except one user. - Lars
This could be easily done by this plugin wordpress.org/plugins/capability-manager-enhanced - Shravan Sharma
No it cannot - because CPTs don't show up. - Lars

1 Answers

1
votes

Solution: In the backend, you have the current admin page's options at the top of the screen. The CPTs are not shown there by default, but can be activated there.

Source: https://wordpress.stackexchange.com/a/37801/9241