I have tried adding a custom filter around my query, using:
$where .= ' AND ' . $wpdb->posts . '.post_excerpt IS NOT NULL AND ' . $wpdb->posts . '.post_content IS NOT NULL';
but that doesn't seem to work. The SQL looks correct (I'm amateur) but it doesn't show correct content and breaks the original query (it was filtering by a custom post type, but the above filter makes query display pages too).
The only way I can think is to query many more posts than I need, do a check on each one for excerpt / content, count through and then break out of loop but that doesn't feel correct.
(NB I will also want to strip shortcodes out of content when displaying).
Thanks.
NULL
is considered asfalse
. instead, use.post_excerpt<>''
, which compares it to an empty string.