mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-01 11:52:25 +08:00
14 lines
453 B
Text
14 lines
453 B
Text
add_filter( 'relevanssi_hits_filter', function( $hits ) {
|
|
$featured = array();
|
|
$everything_else = array();
|
|
foreach ( $hits[0] as $_post ) {
|
|
$post_object = relevanssi_get_an_object( $_post )['object'];
|
|
if ( has_term( 'featured', 'product_tag', $post_object->ID ) {
|
|
$featured[] = $_post;
|
|
} else {
|
|
$everything_else[] = $_post;
|
|
}
|
|
}
|
|
$hits[0] = array_merge( $featured, $everything_else );
|
|
return $hits;
|
|
} );
|