Action hook 'wp_nav_menu_item_custom_fields'

in WP Core File wp-admin/includes/class-walker-nav-menu-edit.php at line 280

View Source

wp_nav_menu_item_custom_fields

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

Hook Information

File Location wp-admin/includes/class-walker-nav-menu-edit.php View on GitHub
Hook Type Action
Line Number 280

Hook Parameters

Type Name Description
string $item_id Menu item ID as a numeric string.
WP_Post $menu_item Menu item data object.
int $depth Depth of menu item. Used for padding.
stdClass|null $args An object of menu item arguments.
int $current_object_id Nav menu ID.

Usage Examples

Basic Usage
<?php
// Hook into wp_nav_menu_item_custom_fields
add_action('wp_nav_menu_item_custom_fields', 'my_custom_function', 10, 5);

function my_custom_function($item_id, $menu_item, $depth, $args, $current_object_id) {
    // Your custom code here
}

Source Code Context

wp-admin/includes/class-walker-nav-menu-edit.php:280 - How this hook is used in WordPress core
<?php
 275  				 * @param WP_Post       $menu_item         Menu item data object.
 276  				 * @param int           $depth             Depth of menu item. Used for padding.
 277  				 * @param stdClass|null $args              An object of menu item arguments.
 278  				 * @param int           $current_object_id Nav menu ID.
 279  				 */
 280  				do_action( 'wp_nav_menu_item_custom_fields', $item_id, $menu_item, $depth, $args, $current_object_id );
 281  				?>
 282  
 283  				<fieldset class="field-move hide-if-no-js description description-wide">
 284  					<span class="field-move-visual-label" aria-hidden="true"><?php _e( 'Move' ); ?></span>
 285  					<button type="button" class="button-link menus-move menus-move-up" data-dir="up"><?php _e( 'Up one' ); ?></button>

PHP Documentation

<?php
/**
				 * Fires just before the move buttons of a nav menu item in the menu editor.
				 *
				 * @since 5.4.0
				 *
				 * @param string        $item_id           Menu item ID as a numeric string.
				 * @param WP_Post       $menu_item         Menu item data object.
				 * @param int           $depth             Depth of menu item. Used for padding.
				 * @param stdClass|null $args              An object of menu item arguments.
				 * @param int           $current_object_id Nav menu ID.
				 */
Quick Info
  • Hook Type: Action
  • Parameters: 5
  • File: wp-admin/includes/class-walker-nav-menu-edit.php
Related Hooks

Related hooks will be displayed here in future updates.