WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

Last modified 8 months ago

#38696 closed defect (bug) (fixed)

Empty Post Attributes meta box showing for all post types when using a child theme

Reported by: justinbusa Owned by: swissspidy
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: Posts, Post Types Keywords: has-patch has-unit-tests commit
Focuses: administration Cc:

Description

This only happens when testing 4.7 beta.

When I have a vanilla child theme installed (no additional code aside from style.css), I'm seeing an empty Post Attributes box on the edit screen for all post types.

When I switch to a parent theme, the issue goes away.

The issue appears with twenty* child themes as well. All plugins have been deactivated.

Attachments (3)

post-attrs.png (13.5 KB) - added by justinbusa 8 months ago.
38696.diff (3.2 KB) - added by swissspidy 8 months ago.
Post Edit Tag Meta box.png (11.3 KB) - added by lukecavanagh 8 months ago.
Post Edit - Attributes Showing

Download all attachments as: .zip

Change History (13)

#1 @ocean90
8 months ago

  • Component changed from General to Posts, Post Types
  • Focuses administration added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.7

Related: [38951]

#2 @swissspidy
8 months ago

Hey there,

Thanks for your report!

Even though I'm pretty sure to have triple-checked, this likely was introduced in #18375 / [38951]. I'll try to reproduce in a few and come up with a patch.

#3 @justinbusa
8 months ago

Thanks! I did some testing and it looks like adding the $post variable to the get_page_templates( $post, $post_type ); call in edit-form-advanced.php fixes the issue.

@swissspidy
8 months ago

#4 @swissspidy
8 months ago

  • Keywords has-patch has-unit-tests added; needs-patch removed

@justinbusa Good catch. This line revealed that \WP_Theme::get_page_templates() isn't passing the $post_type when checking for templates of the parent theme, causing a false positive.

38696.diff adds a test for checking templates of a child theme.

#5 @lukecavanagh
8 months ago

@swissspidy 

The patch fixed the issue.

@lukecavanagh
8 months ago

Post Edit - Attributes Showing

This ticket was mentioned in Slack in #core by helen. View the logs.


8 months ago

#7 @swissspidy
8 months ago

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

#8 @swissspidy
8 months ago

  • Keywords commit added

#9 @swissspidy
8 months ago

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

In 39168:

Posts, Post Types: Fix post type templates with child themes.

After [38951] added support for post type templates beyond pages, this fixes an issue where an empty meta box would be shown when using child themes.

Fixes #38696.

#10 @jorbin
8 months ago

In 39170:

Posts, Post Types: Fix themes tests broken in [39168]

[39168] introduced a new theme to the tests, but it wasn't taken into account in Tests_Theme_ThemeDir::test_theme_list.

See #38696.

Note: See TracTickets for help on using tickets.