Custom post type at the top of WordPress search results
Paste this in to your functions.php file – this assumes your CPT is called ‘products’
add_filter( 'posts_search_orderby', function( $search_orderby ) {
global $wpdb;
return "{$wpdb->posts}.post_type LIKE 'products' DESC, {$search_orderby}";
});