[wp-hackers] Need Custom Post Type Rewrite Help, Please

Andrew Nacin wp at andrewnacin.com
Sun Apr 18 22:00:14 UTC 2010


On Sun, Apr 18, 2010 at 5:47 PM, Mike Schinkel <mikeschinkel at newclarity.net>
 wrote:

> > if ( is_post_type( 'financial-term', $id ) )


> I assume this is sarcastic?  If so, was there something I did wrong?


On Sun, Apr 18, 2010 at 5:52 PM, Mike Schinkel <mikeschinkel at newclarity.net>
 wrote:

> > if ( 'financial-term' == get_post_type($id) )
>

> Perfect! Thanks.


No, it wasn't sarcastic. I'm also not sure how much more clear I could have
gotten. I literally added is_post_type() today:
http://trac.wordpress.org/changeset/14158.

Pass it a post type and a post, and it'll tell you if the post is of that
type -- that's exactly what scribu proposed for you, only it's simpler.

The function is more powerful than that -- it can take an array of post
types to validate the post against. It can also take only a post type, and
it'll tell you whether that post type is indeed registered.


More information about the wp-hackers mailing list