The post_excerpt
column is a string and is not filterable using “IS NOT NULL” . To query for an empty string you can use the !=
operator.
function posts_where_excerpt_not_empty( $where ) {
$where .= " AND post_excerpt != '' ";
return $where;
}
Also get_posts suppresses filters by default so you will need to call it with suppress filters set to false or use another query method.
$posts = get_posts( array( 'suppress_filters' => FALSE ) );