#30: nav_menu_meta_box_object

The nav_menu_meta_box_object filter allows you to modify a nav menu meta box object.

It was added in 3.0.

It is evaluated in wp_ajax_menu_get_metabox() in the wp-admin/includes/ajax-actions.php file.

nav_menu_meta_box_object accepts a single argument:

  1. object $item_object The nav menu meta box object, e.g. Page, Post, Category, Tag, etc.

Example:

The following example renames the ‘Categories’ and ‘Tags’ accordion sections in the menus screen to ‘Category Archives’ and ‘Tag Archives’ respectively since adding menu links to specific terms in these taxonomies will point to their archives anyway.

View the code example on Gist.

#29: wp_edit_nav_menu_walker

The wp_edit_nav_menu_walker filter allows you to change the Walker class used when adding menu items.

It was added in 3.4.

It is evaluated in wp_ajax_add_menu_item() in the wp-admin/includes/ajax-actions.php file.

wp_edit_nav_menu_walker accepts 2 arguments:

  1. string $class The Walker class to use when adding menu items. Default is ‘Walker_Nav_Menu_Edit’
  2. int $menu_id The menu id. Uses the value of $_POST['menu'].

Example:

The following example changes the Walker class used when adding new menu items. Note: This example does not include the custom Walker class, it’s just an example to demonstrate how to tell WordPress to use your class instead of Walker_Nav_Menu_Edit.

View the code example on Gist.