Make WordPress Core

Opened 4 years ago

Last modified 22 months ago

#46604 new defect (bug)

Twenty Seventeen: Front page panels allow pages of any status to be shown.

Reported by: brettshumaker's profile brettshumaker Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch needs-testing
Focuses: Cc:

Description

I noticed that if you have a published page set to a Front Page Section X Content and that page is then set to private, draft, pending, or trash at some point in the future, the content still appears on the homepage. And if the page is deleted permanently, an error is shown and the content of the "Homepage" is shown again.

When going back into the Customizer > Theme Options, pages that do not have the status publish no longer show up in the select box. This makes it unclear to the user what has happened.

Choosing — Select — and publishing the Customizer changes removes the page(s), but I think that's a suboptimal experience.

It's easy enough to check the post_status of the page before displaying the panel, but some thought will need to go into how to handle that situation in the Customizer.

Attachments (6)

every-page-pubished.png (491.6 KB) - added by brettshumaker 4 years ago.
This shows the initial state of the customizer - all Front Panel pages are published.
customizer-after-altering-post-status.png (562.7 KB) - added by brettshumaker 4 years ago.
This shows the customizer view after altering the post_status of the chosen pages.
front-after-altering-post-status.png (365.9 KB) - added by brettshumaker 4 years ago.
This is the logged out, front end view after altering the post_status of the chosen pages.
46604.patch (691 bytes) - added by sabernhardt 22 months ago.
checks $post variable and post_status before displaying panel content
46604.2.patch (1.3 KB) - added by sabernhardt 22 months ago.
also adjusts Customizer to show placeholder if selected page is draft/trashed/deleted
46604.3.patch (1.3 KB) - added by sabernhardt 20 months ago.
updating in_array to use strict

Download all attachments as: .zip

Change History (7)

@brettshumaker
4 years ago

This shows the initial state of the customizer - all Front Panel pages are published.

@brettshumaker
4 years ago

This shows the customizer view after altering the post_status of the chosen pages.

@brettshumaker
4 years ago

This is the logged out, front end view after altering the post_status of the chosen pages.

@sabernhardt
22 months ago

checks $post variable and post_status before displaying panel content

@sabernhardt
22 months ago

also adjusts Customizer to show placeholder if selected page is draft/trashed/deleted

#1 @sabernhardt
22 months ago

  • Keywords has-patch needs-testing added

Hi and welcome to WordPress Core Trac!

I think there might be a use case for private page content within a private/membership site. If not, the conditional could check for publish status only.

Verifying $post first in the conditional seems to avoid getting errors on post_status.

The first patch does not show placeholders again in Customizer if the previously selected page is switched to draft status or trashed, so I made another version for that.

@sabernhardt
20 months ago

updating in_array to use strict

Note: See TracTickets for help on using tickets.