Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#22331 closed defect (bug) (fixed)

show_home not working on wp_page_menu

Reported by: brasofilo Owned by: lancewillett
Milestone: 3.5 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:


As reported here, this function call doesn't returns the expected output:
wp_page_menu( array( 'show_home' => 'Hjem', 'sort_column' => 'menu_order' ) );

Looks like show_home is being ignored. It keeps outputting "Home" instead of the custom text and even setting it as false doesn't behave as expected.

If the filter wp_page_menu_args is used, wp_page_menu works correctly.

Tested in WordPress 3.4.2 and 3.5-beta2, no active plugins, using TwentyEleven.

Attachments (2)

22331.patch (1.6 KB) - added by SergeyBiryukov 3 years ago.
22331.2.patch (1.6 KB) - added by kovshenin 3 years ago.
Using isset instead of empty

Download all attachments as: .zip

Change History (6)

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Bundled Theme
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.5

The culprit is twentyeleven_page_menu_args() (twentytwelve_page_menu_args() in Twenty Twelve).

It ignores any passed value and enforces true instead:

22331.patch is a fix for all three themes.

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

3 years ago

Using isset instead of empty

#2 @kovshenin
3 years ago

22331.2.patch uses isset instead of empty which also allows 'show_menu' => false with wp_page_menu.

#3 @SergeyBiryukov
3 years ago

Good call, thanks.

#4 @lancewillett
3 years ago

  • Owner set to lancewillett
  • Resolution set to fixed
  • Status changed from new to closed

In 22359:

Bundled Themes: allow show_home argument to be overridden when using wp_page_menu as a fallback to a Custom Menu. Props SergeyBiryukov and kovshenin, fixes #22331.

Note: See TracTickets for help on using tickets.