[ad_1]
Relevanssi Premium has post type weights on the search settings page. Free version doesn’t, but you have other options.
If you want to ensure all pages come up first, you can sort the results by post type.
Here’s a filter function for increasing the weight of the pages:
add_filter( 'relevanssi_results', function( $postid_weight) {
array_walk( $postid_weight, function( &$weight, $post_id ) {
$post_type = relevanssi_get_post_type( $post_id );
if ( 'page' === $post_type ) {
$weight *= 100;
}
});
return $postid_weight;
} );Adding extra keywords helps, too. Relevanssi counts how many times each word appears in the post and uses that in calculations; you can add, for example, a custom field that has extra keywords to boost the pages.
Perfect thank you!
I will ask the customer if they want to buy premium. But this workaround works fine for the moment!
