Skip to content

Instantly share code, notes, and snippets.

@PetrovStark
Created May 6, 2019 18:45
Show Gist options
  • Save PetrovStark/62c122e4aef34279c8b0b6ae9fa99cfd to your computer and use it in GitHub Desktop.
Save PetrovStark/62c122e4aef34279c8b0b6ae9fa99cfd to your computer and use it in GitHub Desktop.
WP Query que filtra posts sem thumbnail
$obj = get_queried_object();
$loop = new WP_Query([
'post_type' => "produtos",
'meta_query' => array(
array(
'key' => '_thumbnail_id',
'compare' => 'NOT EXISTS'
)),
'tax_query' => [[
'taxonomy' => 'tipos-produtos',
'field' => 'slug',
'terms' => $obj->slug,
]
],
'orderby' => 'date',
'order' => 'ASC'
]);
//DISPLAY
while ( $loop->have_posts() ) :
$loop->the_post();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment