[wp-trac] [WordPress Trac] #12588: Add function to check if current page is a custom post type

WordPress Trac wp-trac at lists.automattic.com
Sat May 8 12:59:58 UTC 2010


#12588: Add function to check if current page is a custom post type
----------------------------+-----------------------------------------------
 Reporter:  sirzooro        |        Owner:  nacin   
     Type:  defect (bug)    |       Status:  reopened
 Priority:  normal          |    Milestone:  3.0     
Component:  Administration  |      Version:  3.0     
 Severity:  normal          |   Resolution:          
 Keywords:  has-patch       |  
----------------------------+-----------------------------------------------

Comment(by scribu):

 Replying to [comment:14 sirzooro]:
 > BTW, please make sure `is_post_of_type()` will return `false` when
 called from non-post pages (e.g. home page, category or date archive). I
 am going to test this within few next days and will let you know if there
 are any issues.

 Why?


 > One more thing: previous function version allowed to skip $types  param,
 and uses all post types (returned by get_post_types()) as default. Please
 change is_post_of_type() to follow this.

 I disagree. It's meant to check agains specific post types; that's why
 it's called is_post_of_type() you know...

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


More information about the wp-trac mailing list