您可以尝试以下操作:
$args = array (
\'post_type\' => \'books\',
\'name\' => \'\',
\'post_status\' => array(\'publish, draft\'),
\'posts_per_page\' => -1,
\'meta_query\' => array(
array(
\'key\' => \'book_isbn_id\',
\'value\' => \'dummy\',
\'compare\' => \'NOT EXISTS\',
\'type\' => \'NUMERIC\',
),
),
);
add_filter( \'posts_where\', \'custom_posts_where\' );
$query = new WP_Query( $args );
echo $query->request;
在哪里
function custom_posts_where( $where )
{
remove_filter( current_filter(), __FUNCTION__ );
if( FALSE === strpos( $where, \'post_name\' ) )
{
$where .= sprintf( " AND %s.post_name = \'\' ", $GLOBALS[\'wpdb\']->posts );
}
return $where;
}
搜索空的帖子名称。