[wp-trac] [WordPress Trac] #17620: get_post_types check for supporting title

WordPress Trac wp-trac at lists.automattic.com
Mon May 30 17:55:21 UTC 2011


#17620: get_post_types check for supporting title
--------------------------+------------------------------
 Reporter:  GaryJ         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Post Types    |     Version:  3.2
 Severity:  normal        |  Resolution:
 Keywords:  close         |
--------------------------+------------------------------
Changes (by GaryJ):

 * severity:  major => normal


Comment:

 Replying to [comment:1 greuben]:
 > Use 'OR' operator if you want all post types that support titles.
 > {{{
 > get_post_types( array( 'supports' => array( 'title' ) ), 'names', 'or' )
 > }}}
 >
 That results in:
 {{{
 Array
 (
     [post] => post
     [page] => page
     [attachment] => attachment
     [revision] => revision
     [nav_menu_item] => nav_menu_item
     [surl] => surl
     [book] => book
 )
 }}}
 My book CPT doesn't have support for title, yet is still included in the
 list.

 @Nacin [http://twitter.com/#!/nacin/status/75254413215809537 says] that
 get_post_types() can't check for support, since it's an array, rather than
 a string/int/bool. The solution is to grab them all and loop through them
 and use post_type_supports().

 Not a bug then - guess I was just trying to do something that hasn't been
 added to core, yet :-)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17620#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list