Commit 396f6fb
committed
Menus: Improve performance by calling
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@59674 602fd350-edb4-49c9-b593-d223f7449a82get_privacy_policy_url() once per Walker_Nav_Menu instance rather than for every nav menu item.1 parent f2f13cb commit 396f6fb
File tree
2 files changed
+44
-39
lines changed- src/wp-includes
2 files changed
+44
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
42 | 59 | | |
43 | 60 | | |
44 | 61 | | |
| |||
236 | 253 | | |
237 | 254 | | |
238 | 255 | | |
239 | | - | |
| 256 | + | |
240 | 257 | | |
241 | 258 | | |
242 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| |||
27 | 34 | | |
28 | 35 | | |
29 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
30 | 50 | | |
31 | 51 | | |
32 | 52 | | |
| |||
39 | 59 | | |
40 | 60 | | |
41 | 61 | | |
| 62 | + | |
42 | 63 | | |
43 | 64 | | |
44 | 65 | | |
| |||
136 | 157 | | |
137 | 158 | | |
138 | 159 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | 160 | | |
151 | 161 | | |
152 | 162 | | |
153 | 163 | | |
154 | | - | |
155 | | - | |
| 164 | + | |
| 165 | + | |
156 | 166 | | |
157 | 167 | | |
158 | 168 | | |
| |||
251 | 261 | | |
252 | 262 | | |
253 | 263 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | 264 | | |
266 | 265 | | |
267 | 266 | | |
268 | 267 | | |
269 | | - | |
270 | | - | |
| 268 | + | |
| 269 | + | |
271 | 270 | | |
272 | 271 | | |
273 | 272 | | |
| |||
296 | 295 | | |
297 | 296 | | |
298 | 297 | | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | 298 | | |
311 | 299 | | |
312 | 300 | | |
313 | 301 | | |
314 | | - | |
| 302 | + | |
315 | 303 | | |
316 | 304 | | |
317 | 305 | | |
| |||
0 commit comments