_add_post_type_submenus

Add submenus for post types.

Description

_add_post_type_submenus(); 

Usage

  1. if ( !function_exists( '_add_post_type_submenus' ) ) { 
  2. require_once ABSPATH . WPINC . '/post.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = _add_post_type_submenus(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post.php  
  1. function _add_post_type_submenus() { 
  2. foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) { 
  3. $ptype_obj = get_post_type_object( $ptype ); 
  4. // Sub-menus only. 
  5. if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true ) 
  6. continue; 
  7. add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" );