wp_nav_menu_post_type_meta_boxes

Creates meta boxes for any post type menu item.

Description

wp_nav_menu_post_type_meta_boxes(); 

.


Usage

  1. if ( !function_exists( 'wp_nav_menu_post_type_meta_boxes' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/nav-menu.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_nav_menu_post_type_meta_boxes(); 
  7.  

Defined (1)

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

/wp-admin/includes/nav-menu.php  
  1. function wp_nav_menu_post_type_meta_boxes() { 
  2. $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); 
  3.  
  4. if ( ! $post_types ) 
  5. return; 
  6.  
  7. foreach ( $post_types as $post_type ) { 
  8. /** 
  9. * Filters whether a menu items meta box will be added for the current 
  10. * object type. 
  11. * If a falsey value is returned instead of an object, the menu items 
  12. * meta box for the current meta box object will not be added. 
  13. * @since 3.0.0 
  14. * @param object $meta_box_object The current object to add a menu items 
  15. * meta box for. 
  16. */ 
  17. $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type ); 
  18. if ( $post_type ) { 
  19. $id = $post_type->name; 
  20. // Give pages a higher priority. 
  21. $priority = ( 'page' == $post_type->name ? 'core' : 'default' ); 
  22. add_meta_box( "add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type );