您可以使用posts_where
过滤挂钩并创建子查询,以排除所有带有视频meta\\u键的帖子:
// Create a new filtering function that will add our where clause to the query
function filter_where_WPSE_18787( $where = \'\' ) {
$where .= " AND ID NOT IN ( SELECT DISTINCT post_id from $wpdb->postmeta WHERE meta_key = \'video\' )";
return $where;
}
add_filter( \'posts_where\', \'filter_where_WPSE_18787\' );
$fsquery = new WP_Query(
array (
\'posts_per_page\' => 1,
\'featured\' => \'yes\'
));
remove_filter(\'posts_where\', \'filter_where_WPSE_18787\' );