[wp-trac] [WordPress Trac] #19148: get_post_types returning more than desired results, taxonomies arg not respected

WordPress Trac wp-trac at lists.automattic.com
Fri Nov 4 12:41:11 UTC 2011


#19148: get_post_types returning more than desired results, taxonomies arg not
respected
--------------------------+-----------------------------
 Reporter:  Ov3rfly       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Post Types    |    Version:  3.2.1
 Severity:  normal        |   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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19148>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list