[wp-trac] [WordPress Trac] #20438: Custom Post Types with Post Format support aren't registered against post_format taxonomy
WordPress Trac
wp-trac at lists.automattic.com
Fri Apr 13 16:56:40 UTC 2012
#20438: Custom Post Types with Post Format support aren't registered against
post_format taxonomy
--------------------------+-----------------------------
Reporter: batmoo | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
--------------------------+-----------------------------
When a custom post type adds support for {{{post-formats}}}, this doesn't
actually register the {{{post_format}}} taxonomy for the post_type.
Here's a quick test:
{{{
add_action( 'init', function() {
register_post_type( 'not-post', array( 'supports' => 'post-
formats' ) );
global $wp_taxonomies;
var_dump( 'post supports post_format:', in_array( 'post',
$wp_taxonomies[ 'post_format' ]->object_type ) );
var_dump( 'not-post supports post_format:', in_array( 'not-post',
$wp_taxonomies[ 'post_format' ]->object_type ) );
} );
}}}
The {{{post_format}}} taxonomy doesn't get returned when
{{{get_object_taxonomies}}} is called for the custom post type and one
side-effect of this is that the {{{post_format_relationships}}} cache does
not get flushed by {{{clean_object_term_cache}}} leading to stale values
when a post format is changed.
(The {{{post}}} post_type is immune to this because core registers the
{{{post_format}}} taxonomy with it.)
When a post_type adds support for post-formats, an explicit association
should be made between the post_type and the {{{post_format}}} taxonomy.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20438>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list