Continue reading Put sticky posts first in results

Put sticky posts first in results

If you want to have sticky posts first in results when they match the search query, just add this code to your theme functions.php: add_filter( ‘relevanssi_hits_filter’, ‘rlv_sticky_first’ ); function rlv_sticky_first( $hits ) { $sticky = array(); $nonsticky = array(); $sticky_post_ids = get_option( ‘sticky_posts’ ); foreach( $hits[0] as $hit ) { if ( in_array( $hit->ID, $sticky_post_ids…

Read more Put sticky posts first in results 0 Comment on Put sticky posts first in results