wp_nav_menu_taxonomy_meta_boxes() WordPress Function

The wp_nav_menu_taxonomy_meta_boxes() function is used to add custom fields to the "Add New Menu Item" screen when creating a new menu in the WordPress admin. This function allows you to add custom fields to any taxonomy (category, post tag, etc.), and is useful for adding extra data to menu items.

wp_nav_menu_taxonomy_meta_boxes() #

Creates meta boxes for any taxonomy menu item.


Source

File: wp-admin/includes/nav-menu.php

function wp_nav_menu_taxonomy_meta_boxes() {
	$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' );

	if ( ! $taxonomies ) {
		return;
	}

	foreach ( $taxonomies as $tax ) {
		/** This filter is documented in wp-admin/includes/nav-menu.php */
		$tax = apply_filters( 'nav_menu_meta_box_object', $tax );
		if ( $tax ) {
			$id = $tax->name;
			add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
		}
	}
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.