Skip to content

[Support request] Custom post types in custom admin menu

Home Forums Troubleshooting Custom post types in custom admin menu

This topic contains 2 replies, has 2 voices, and was last updated by 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24790 Reply

    I am having trouble getting permissions to work for my custom post types, but only the ones that live in a custom admin menu I created:


    add_filter('custom_menu_order', 'pw_custom_menu_order'); // Activate custom_menu_order
    add_filter('menu_order', 'pw_custom_menu_order');
    function pw_custom_menu_order($menu_ord) {
    if (!$menu_ord)
    return true;

    return array(
    'index.php', // Dashboard
    'edit.php', // Posts
    'edit.php?post_type=page', // Pages
    'pw-parts-slug', // Parts
    'separator1', // First separator
    ...

    So, when I assign a permission to this custom post type, it doesn’t work (the user gets a “Sorry, you don’t have permission” screen:


    /* Speech Post Type */
    register_post_type('speech', array(
    'labels' => array(
    'name' => __('Speeches'),
    'singular_name' => __('Speech')
    ),
    'public' => true,
    'show_in_menu'=> 'pw-parts-slug',
    'show_in_rest' => true,
    'has_archive' => true,
    'hierarchical' => true,
    'supports' => array('title', 'editor', 'thumbnail'),
    )
    );

    But if I change the above line to:


    'show_in_menu'=> 'edit.php?post_type=page',

    The same user can access the post type area. Any ideas for workaround? I’d really like to keep the custom menu as there are many custom post types.

    Thanks.

    #24800 Reply

    [ login required ]

    #24820 Reply

    [ login required ]

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Registered members have full access to Pro support forums here.

Feel free to log in or purchase a support key.