#57198 closed defect (bug) (fixed)
WP_Customize_Manager::has_published_pages() fails when queried page is not top-level
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | 6.0 |
Component: | Customize | Keywords: | has-patch has-testing-info commit |
Focuses: | Cc: |
Description
The Homepage Settings section on the customizer uses WP_Customize_Manager::has_published_pages()
as active_callback
.
Unfortunately, the changes introduced for bug #55425 lead to an error with the logical check, which is that when the queried page it's not top-level (post_parent = 0
), get_pages()
incorrectly returns an empty array.
This could be solved by adding 'hierarchical' => 0
to the get_pages()
arguments.
Change History (8)
This ticket was mentioned in PR #3680 on WordPress/wordpress-develop by felipelavinz.
2 years ago
#1
- Keywords has-patch added
#2
@
2 years ago
- Milestone changed from Awaiting Review to 6.2
- Version changed from trunk to 6.0
Welcome back to Trac, @felipelavinz, and thanks for the report!
I've been able to replicate this bug on a new installation using these steps:
- Switch to the Twenty Twenty theme.
- Publish the draft "Privacy Policy" page, and make it a child of "Sample Page"
- Open the Customizer, and observe that the "Homepage Settings" section is missing.
The fix in the PR makes sense to me and works in my testing. Marking for 6.2 consideration.
#3
@
2 years ago
Thank you, I'm glad to help!
Let me know if there's anything else I can do, it would be great to have this fix for 6.2 :-)
#4
@
2 years ago
- Keywords has-testing-info added
Test Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/3680/
Steps to Reproduce or Test
- Switch to the Twenty Twenty theme.
- Publish the draft "Privacy Policy" page, and make it a child of "Sample Page".
- 🐞 Navigate to
Appearance > Customize
.
Expected Results
When reproducing a bug:
- ❌ The "Homepage Settings" section should be missing.
When testing a patch to validate it works as expected:
- ✅ The "Homepage Settings" section should be available.
Environment
- Server: Apache (Linux)
- WordPress: 6.1.1
- Browser: Chrome 107.0.0.0
- OS: Windows 10
- Theme: Twenty Twenty
- Plugins: None activated
Actual Results
When reproducing a bug/defect:
- ❌ Issue reproduced. The "Homepage Settings" section is missing.
When testing the bugfix patch:
- ✅ Patch resolves the issue. The "Homepage Settings" section is available.
Notes
- The patch works as expected. Adding for
commit
consideration.
#6
@
2 years ago
- Owner set to audrasjb
- Status changed from new to accepted
Thank for the patch @felipelavinz and for the test cases @dlh and @costdev ✌️
I can reproduce the error and the patch fixes the issue on my case.
Self assigning for commit
.
@audrasjb commented on PR #3680:
2 years ago
#8
committed in https://core.trac.wordpress.org/changeset/54935
Add
hierarchical = 0
to theget_pages()
call onWP_Customize_Manager::has_published_pages()
so the check doesn't fail when the queried page is not top-level.Trac ticket: https://core.trac.wordpress.org/ticket/57198