Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: nav_menu_meta_box_object

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
220            *
221            * If a falsey value is returned instead of an object, the menu items
222            * meta box for the current meta box object will not be added.
223            *
224            * @since 3.0.0
225            *
226            * @param WP_Post_Type|false $post_type The current object to add a menu items
227            *                                      meta box for.
228            */
229           $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
230           if ( $post_type ) {
231                $id = $post_type->name;
232                // Give pages a higher priority.
233                $priority = ( 'page' === $post_type->name ? 'core' : 'default' );
234                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 );
235           }
236      }
237 }
238
 
Line Code
244 function wp_nav_menu_taxonomy_meta_boxes() {
245      $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' );
246
247      if ( ! $taxonomies ) {
248           return;
249      }
250
251      foreach ( $taxonomies as $tax ) {
252           /** This filter is documented in wp-admin/includes/nav-menu.php */
253           $tax = apply_filters( 'nav_menu_meta_box_object', $tax );
254           if ( $tax ) {
255                $id = $tax->name;
256                add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
257           }
258      }
259 }
260
261 /**
262  * Check whether to disable the Menu Locations meta box submit button and inputs.