Opened 10 years ago
Closed 10 years ago
#33218 closed defect (bug) (fixed)
Customizer: Does Not Read the Default wp_page_menu fallback_cb for wp_nav_menu
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | Customize | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
It appears the Customizer does not read the default wp_page_menu
fallback_cb
for wp_nav_menu
.
To reproduce:
- Make sure you have test data with pages and menus. The theme unit tests are good for this.
- On Trunk, activate Twenty Fourteen. Make sure you do not have a menu assigned in the the primary location.
- Next, view the site in the Customizer. You'll see no fallback menu, but an empty
nav
container where it should be. Like this: https://cloudup.com/cUuNcEaSHse - If you view the site on the front end, the fallback is there.
What I expected? For the fallback to be rendered by the Customizer, like it is on the front end.
Reproduced in Twenty Thirteen and Twenty Twelve as well.
If I declare 'fallback_cb' => ‘wp_page_menu’
as part of wp_nav_menu
, it works in the Customizer. But that is the default, so it should work without declaring it.
Attachments (1)
Change History (10)
#2
@
10 years ago
We added this recently to wp_nav_menu()
in the 4.3 release:
// Prevent a fallback_cb in Customizer Preview to assist with has_nav_menu() and partial refresh. if ( is_customize_preview() ) { $defaults['fallback_cb'] = ''; }
So this is probably what you're noticing here. However, I think that recent changes have made this unnecessary, but I haven't yet verified that. In the mean time, you can just explicitly supply the default fallback_cb
as @atomicjack suggested.
This ticket was mentioned in Slack in #core by obenland. View the logs.
10 years ago
#4
@
10 years ago
- Milestone changed from Awaiting Review to 4.3
- Owner set to westonruter
- Status changed from new to assigned
Could you verify ifun setting fallback_cb
is necessary?
#5
@
10 years ago
- Focuses javascript removed
- Keywords has-patch added
Tested 33218.patch with Twenty Fourteen and Twenty Eleven and it works as expected. Switching between a fallback and a nav menu does a full refresh but subsequent updates are doing a partial refresh.
#6
@
10 years ago
- Keywords commit added
And the full refreshes are expected since the Customizer preview isn't able to wrap the wp_nav_menu()
calls for fallback callbacks. In Twenty Fifteen it doesn't appear to work but this is only because the wp_nav_menu()
calls are wrapped in has_nav_menu()
checks, and so the fallbacks are never called anyway. So yeah, this looks good to remove.
I recommend you submit a patch with the fallback_cb implementation as you stated above, then if there's an actual bug with it not being declared by default, that can be worked on later. At least this way we could get the patch, albeit temporary, in time for release. Just my feelings.