0

I'm trying to get posts with not marked with any type of post types (aside, audio etc). But I didn't find any solution to do this. I thought doing this with custom fields but site has a lot of posts...

1
  • 1
    If indeed you're asking about post format, please update your post title and question so it's clear for the future.
    – mrwweb
    Commented Aug 27, 2014 at 23:27

1 Answer 1

0

I believe that you're asking about post format and not post type. Assuming that's correct, you'll probably be using WP_Query to query all posts of the post format "Standard." However, as noted in this trac ticket, there's strangely no way to query for the standard post format. Instead you need to query for all posts NOT IN any other format.

Alex King put together a fairly involved snippet that does this.

A simpler snippet is found in this Stackoverflow answer to a similar question:

array(
    'taxonomy' => 'post_format',
    'field' => 'slug',
    'terms' => array('post-format-quote','post-format-audio','post-format-gallery','post-format-image','post-format-link','post-format-video', 'post-format-aside'),
    'operator' => 'NOT IN'
)

The above would be the value of the tax_query argument in an instance of WP_Query.

2
  • I added 'post-format-aside' to in my code and it solved my problem thank you @mrwweb. updated title ^^.
    – ahmetertem
    Commented Aug 28, 2014 at 4:12
  • Good catch. Code updated.
    – mrwweb
    Commented Aug 28, 2014 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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