Make WordPress Core

Changeset 54178


Ignore:
Timestamp:
09/15/2022 12:30:54 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Docs: Clarify documentation for the nav_menu_item_id filter.

This aims to make it clear that the filter is applied to an HTML ID attribute for the menu item's <li> element, and not a numeric ID.

Follow-up to [15407], [25410], [27201], [38559], [51739].

Props dilipbheda, robinwpdeveloper, mukesh27, audrasjb, SergeyBiryukov.
See #56574, #55646.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-walker-nav-menu.php

    r52652 r54178  
    160160
    161161                /**
    162                  * Filters the ID applied to a menu item's list item element.
     162                 * Filters the ID attribute applied to a menu item's list item element.
    163163                 *
    164164                 * @since 3.0.1
    165165                 * @since 4.1.0 The `$depth` parameter was added.
    166166                 *
    167                  * @param string   $menu_id   The ID that is applied to the menu item's `<li>` element.
    168                  * @param WP_Post  $menu_item The current menu item.
    169                  * @param stdClass $args      An object of wp_nav_menu() arguments.
    170                  * @param int      $depth     Depth of menu item. Used for padding.
     167                 * @param string   $menu_item_id The ID attribute applied to the menu item's `<li>` element.
     168                 * @param WP_Post  $menu_item    The current menu item.
     169                 * @param stdClass $args         An object of wp_nav_menu() arguments.
     170                 * @param int      $depth        Depth of menu item. Used for padding.
    171171                 */
    172172                $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $menu_item->ID, $menu_item, $args, $depth );
Note: See TracChangeset for help on using the changeset viewer.