Make WordPress Core

#22473 closed defect (bug) (fixed)

Post-formats radiogroup on custom post types and pages will not update in 3.5 Beta 3

Reported by: itworx Owned by: ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: General Keywords: has-patch needs-unit-tests commit
Focuses: Cc:


The post-formats are being saved, but the radiogroup will not show selected format after publishing, but stays checked at Standard post-format.

Works only on posts.

Attachments (2)

22473.patch (1.3 KB) - added by SergeyBiryukov 17 months ago.
22473.2.patch (1.3 KB) - added by SergeyBiryukov 17 months ago.

Download all attachments as: .zip

Change History (15)

comment:1 itworx17 months ago

  • Keywords dev-feedback added

comment:2 itworx17 months ago

  • Keywords dev-feedback removed

comment:3 c3mdigital17 months ago

  • Keywords needs-patch added

I can confirm this.

Enable post format support and add for pages.

add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
add_post_type_support( 'page', 'post-formats' );

get_theme_support( 'post-formats' );
returns the correct array of post formats.

get_post_format() always returns false on page or custom post types.

Create new page and change post format from normal and publish or save draft. On refresh the checked value goes back to normal.

Last edited 17 months ago by c3mdigital (previous) (diff)

comment:4 SergeyBiryukov17 months ago

  • Milestone changed from Awaiting Review to 3.5

Broken in [21981], which added ! is_object_in_taxonomy() check to get_the_terms():

SergeyBiryukov17 months ago

comment:5 SergeyBiryukov17 months ago

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

22473.patch reverts a part of [21981].

comment:7 nacin17 months ago

I was under the impression that register_taxonomy_for_object_type() was also necessary for proper post format support with custom post types. I mentioned in #20438 (which Sergey linked to, thanks) that we decided that back in 3.1.

Of course, if something that happened to work previously now works, we should fix.

SergeyBiryukov17 months ago

comment:8 SergeyBiryukov17 months ago

22473.patch caused a warning in wp_list_pluck() after saving changes in Quick Edit.

22473.2.patch fixes that.

comment:9 nacin17 months ago

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

comment:10 nacin17 months ago

Yeah, 22473.2.patch looks good to me. get_the_terms() is too much of a generic-use function for us to get away with a formal taxonomy check.

comment:11 nacin17 months ago

  • Keywords commit added

comment:13 ryan17 months ago

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

In 22722:

Don't bail from get_the_terms() if the post type is not registed for the taxonomy. This can break back compat when add_post_type_support( 'page', 'post-formats' ) is called but register_taxonomy_for_object_type( 'postr_-format', 'page' ) is not.

Props SergeyBiryukov
fixes #22473

Note: See TracTickets for help on using tickets.