wp_nav_menu_item_custom_fields WordPress Action Hook

The wp_nav_menu_item_custom_fields hook allows you to add custom fields to the nav menu item edit screen. This can be useful for adding extra data to menu items, such as custom CSS classes or data attributes.

do_action( 'wp_nav_menu_item_custom_fields', string $item_id, WP_Post $menu_item, int $depth, stdClass|null $args, int $current_object_id ) #

Fires just before the move buttons of a nav menu item in the menu editor.


Parameters

$item_id

(string)Menu item ID as a numeric string.

$menu_item

(WP_Post)Menu item data object.

$depth

(int)Depth of menu item. Used for padding.

$args

(stdClass|null)An object of menu item arguments.

$current_object_id

(int)Nav menu ID.


Top ↑

Source

File: wp-admin/includes/class-walker-nav-menu-edit.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.4.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.