Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When you register a post type you can pass an array of arguments that it "supports." (For example, "page-attributes," "author," "editor," etc.)

I see that get_post_types has some args you can filter by, but how can I filter those that "support" specific features such as "page-attributes" or "author"? I realize I could run a loop to filter after the fact, but can this be done without an extra step?

Thanks.

share|improve this question

1 Answer 1

Yes, this can be done. Here's how:

get_post_types( array('supports' => array('page-attributes')), 'names', 'OR');

This Trac ticket provides some explanation as to why that last parameter—the 'OR'—is necessary: http://core.trac.wordpress.org/ticket/17620

share|improve this answer
    
Thanks for the reply. I'm running into the same thing as GaryJ (core.trac.wordpress.org/ticket/17620#comment:2). It's appears to be returning all posts—those that do and don't provide support. I'm just going to stick with subsequent loop using post_type_supports() for now. –  robertwbradford Dec 9 '11 at 20:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.