Make WordPress Core

Opened 5 years ago

Closed 4 weeks ago

#46604 closed defect (bug) (fixed)

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

Reported by: brettshumaker's profile brettshumaker Owned by: karmatosed's profile karmatosed
Milestone: 6.7 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch needs-testing commit
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 5 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 5 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 5 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 3 years ago.
checks $post variable and post_status before displaying panel content
46604.2.patch (1.3 KB) - added by sabernhardt 3 years ago.
also adjusts Customizer to show placeholder if selected page is draft/trashed/deleted
46604.3.patch (1.3 KB) - added by sabernhardt 3 years ago.
updating in_array to use strict

Download all attachments as: .zip

Change History (12)

@brettshumaker
5 years ago

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

@brettshumaker
5 years ago

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

@brettshumaker
5 years ago

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

@sabernhardt
3 years ago

checks $post variable and post_status before displaying panel content

@sabernhardt
3 years ago

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

#1 @sabernhardt
3 years 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
3 years ago

updating in_array to use strict

#2 @karmatosed
2 months ago

  • Milestone changed from Awaiting Review to Future Release

#3 @karmatosed
5 weeks ago

  • Owner set to karmatosed
  • Status changed from new to assigned

#4 @karmatosed
4 weeks ago

  • Milestone changed from Future Release to 6.7

I am going to take a look at this, test and look into if this could be committed - thank you.

#5 @karmatosed
4 weeks ago

  • Keywords commit added

In testing this works now so I am going to move this to commit. Thank you.

#6 @karmatosed
4 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 58687:

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

If you have a published page set to a section but also private, draft, pending or trash at some point in the future it was still showing on the homepage. There was no clarity to the user what was happening. This adds in a check to the post_status variable before displaying panel content and adjusts the customizer to show a placeholder if the page is draft,trashed,deleted.

Props brettshumaker, sabernhardt.
Fixes #46604.

Note: See TracTickets for help on using tickets.