get_post_types returning more than desired, custom post type objects contain taxonomies
|Reported by:||Ov3rfly||Owned by:|
|Component:||Posts, Post Types||Keywords:|
In addition to the desired custom post types with a certain taxonomy, other custom post types are being returned with this get_post_types example:
$args = array( 'public' => true, '_builtin' => false, 'taxonomies' => array('post_tag') ); $post_types = get_post_types($args, 'objects'); print_r($post_types);
Expected results: All public custom post types with (at least) taxonomy 'post_tag'.
Actual results: All public custom post types, also if they do not have 'post_tag' set as taxonomy.
Result of above print_r() http://pastebin.com/4dL7i0DU
Note the empty taxonomies at post type slider:
... [slider] => stdClass Object ( ... [taxonomies] => Array ( ) ...
http://codex.wordpress.org/Function_Reference/get_post_types lists 'taxonomies' as valid argument.
Related older thread, but no discussion there: http://wordpress.org/support/topic/get_post_types-returns-more-than-expected
New ticket as similar http://core.trac.wordpress.org/ticket/12966 was closed on a completed milestone.
Change History (9)
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
- Resolution worksforme deleted
- Status changed from closed to reopened
- Summary changed from get_post_types returning more than desired results, taxonomies arg not respected to get_post_types returning more than desired, custom post type objects contain taxonomies