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 Answer
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
.
-
I added 'post-format-aside' to in my code and it solved my problem thank you @mrwweb. updated title ^^. Commented Aug 28, 2014 at 4:12
-