Add to search posts query array with post IDS which will appear first

Is there a way to add array of post IDS to set posts to be on top of search results?

Something like adding a param top_post_ids inside the search hool:

$query->set( ‘top_post_ids’, [45, 78, 94 ] );

If these posts will appear in search results, they should be on top.

Sticky posts would not solve this issue in this case, has to be array of post IDS.

Read more here:: Add to search posts query array with post IDS which will appear first

Leave a Reply

Your email address will not be published. Required fields are marked *