Skip to content

Commit e331139

Browse files
authored
fix: return no posts for authors without term (#2033)
1 parent 35970f9 commit e331139

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

includes/class-newspack-blocks.php

+4
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,10 @@ public static function build_articles_query( $attributes, $block_name ) {
688688
$term = $coauthors_plus->get_author_term( $co_author );
689689
if ( $term ) {
690690
$authors_term_ids[] = $term->term_id;
691+
} else {
692+
// If the author term does not exist, force a non-match, otherwise all posts will be returned.
693+
// CAP's cli command to create author terms will only create terms for users that have authored posts.
694+
$authors_term_ids[] = -1;
691695
}
692696

693697
// If it's a guest author, also check the linked author.

0 commit comments

Comments
 (0)