Wordpress - Custom Theme Development
You want to display a list of posts excluding category 'news' and showing only posts with the custom field 'featured' set to 'yes'. Which WP_Query arguments correctly achieve this?
'cat' => '-ID' excludes a category by its ID. get_cat_ID('news') gets the ID.meta_query with key and value to filter posts by custom fields.['cat' => '-'.get_cat_ID('news'), 'meta_query' => [['key' => 'featured', 'value' => 'yes']]] uses negative cat ID and meta_query array properly.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions