Make WordPress Core

Changeset 55352


Ignore:
Timestamp:
02/16/2023 12:02:21 AM (7 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Replace strval() with (string) type casting in wp_nav_menu().

This adjusts a newly introduced instance for consistency with the rest of core.

Follow-up to [49108], [55059].

See #57169.

File:
1 edited

Legend:

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

    r55349 r55352  
    201201        /*
    202202         * Fix invalid `menu_item_parent`. See: https://core.trac.wordpress.org/ticket/56926.
    203          * Compare as strings. Plugins may change the ID to string.
    204          * To avoid modifying the object, use `strval()` rather than casting to (string).
     203         * Compare as strings. Plugins may change the ID to a string.
    205204         */
    206         if ( strval( $menu_item->ID ) === strval( $menu_item->menu_item_parent ) ) {
     205        if ( (string) $menu_item->ID === (string) $menu_item->menu_item_parent ) {
    207206            $menu_item->menu_item_parent = 0;
    208207        }
Note: See TracChangeset for help on using the changeset viewer.