Skip to content

Commit

Permalink
Infinite Scroll: check that search terms exist before matching agains…
Browse files Browse the repository at this point in the history
…t post title.

Merges #2128
Fixes #2075
Props cainm

https://[private link]

Merges r132543-wpcom.
  • Loading branch information
jeherve authored and georgestephanis committed Feb 1, 2017
1 parent 3d043d7 commit 69612b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/infinite-scroll/infinity.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,11 @@ function has_only_title_matching_posts() {
}

//actual testing. As search query combines multiple keywords with AND, it's enough to check if any of the keywords is present in the title
if ( false !== strpos( $post->post_title, current( $search_terms ) ) ) {
$term = current( $search_terms );
if ( ! empty( $term ) && false !== strpos( $post->post_title, $term ) ) {
return true;
}

return false;
}

Expand Down

0 comments on commit 69612b1

Please sign in to comment.