[wp-trac] [WordPress Trac] #62818: Walker_Nav_Menu duplicated queries introduced by get_privacy_policy_url() call
WordPress Trac
noreply at wordpress.org
Tue Jan 21 21:25:15 UTC 2025
#62818: Walker_Nav_Menu duplicated queries introduced by get_privacy_policy_url()
call
------------------------------+--------------------------
Reporter: arzola | Owner: westonruter
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.8
Component: Menus | Version: 6.2
Severity: normal | Resolution: fixed
Keywords: has-patch commit | Focuses: performance
------------------------------+--------------------------
Changes (by westonruter):
* status: accepted => closed
* resolution: => fixed
Comment:
In [changeset:"59674" 59674]:
{{{
#!CommitTicketReference repository="" revision="59674"
Menus: Improve performance by calling `get_privacy_policy_url()` once per
`Walker_Nav_Menu` instance rather than for every nav menu item.
The `start_el()` method in `Walker_Nav_Menu` was calling
`get_privacy_policy_url()` for every menu item when building menus. This
resulted in redundant queries, particularly for menus with many items.
This obtains the `get_privacy_policy_url()` value in the constructor for
reuse in the `start_el()` method to improve performance.
Redundant code to construct the privacy policy page is also refactored
into the `set_up()` method during tests.
Props arzola, swissspidy, westonruter, mukesh27.
Fixes #62818.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62818#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list