How Do I Programmatically Better Organize Custom Post Type Menus?

A project I inherited had a dozen custom post types. Trouble is, they all come off the admin menu sidebar separately. It’s not very tidy. Is there a plugin where I can make these subitems of a parent menu, or is there a way, programmatically, I can edit my theme’s functions.php to make it make these as submenus?

1 Answer
1

On the function to register a new custom post type can you set this CPT as Submenu to a exist menu item. Use the param show_in_menu

A example:

register_post_type( 
    'issue', 
    apply_filters( 'wpit_register_issue_post_type', 
        array(
            'labels'          => $issue_labels,
            'rewrite'         => $issue_rewrite,
            'supports'        => $issue_supports,
            'taxonomies'      => $issue_taxonomies,
            'menu_position'   => 5,
            'public'          => TRUE,
            'show_ui'         => TRUE,
            'show_in_menu'    => 'edit.php',
            'can_export'      => TRUE,
            'capability_type' => 'post',
            'query_var'       => TRUE
        )
    ) 
);

You find the string for the items on mouse over, like upload.phpon the item Media.

Leave a Comment