Skip to content

Commit

Permalink
Merge pull request #3010 from 10up/burhan/fix-2974
Browse files Browse the repository at this point in the history
Fix Custom results are not highlighted
  • Loading branch information
felipeelia authored Sep 30, 2022
2 parents 6e3b84c + c4cc65b commit 1b8cbed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/classes/Feature/SearchOrdering/SearchOrdering.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ public function posts_results( $posts, $query ) {
if ( isset( $post->terms ) && isset( $post->terms[ self::TAXONOMY_NAME ] ) ) {
foreach ( $post->terms[ self::TAXONOMY_NAME ] as $current_term ) {
if ( strtolower( $current_term['name'] ) === $search_query ) {
$to_inject[ $current_term['term_order'] ] = $post->ID;
$to_inject[ $current_term['term_order'] ] = $post;

unset( $posts[ $key ] );

Expand All @@ -673,7 +673,7 @@ public function posts_results( $posts, $query ) {

if ( ! empty( $to_inject ) ) {
foreach ( $to_inject as $position => $newpost ) {
array_splice( $posts, $position - 1, 0, $newpost );
array_splice( $posts, $position - 1, 0, array( $newpost ) );
}
}

Expand Down

0 comments on commit 1b8cbed

Please sign in to comment.