This Documentation is for SearchWP Version 3

Available since: 2.8.16


View Parameters »

By default SearchWP orders results according to their relevancy (which is computed according to “weight” as defined on the SearchWP settings screen when configuring your engine(s)) in DESC so as to show the most relevant results (i.e. that have the most weight) at the top.

Sometimes plugins or custom functionality put into a theme will alter this sort order to be ASC which in some cases can cause SearchWP’s results to be returned backwards.

As a result, SearchWP ignores the query order as defined by $wp_query but if there is a circumstance in which you want SearchWP to respect the order defined by $wp_query you can add the following to your theme’s functions.php:

// Force SearchWP to use the sort order as defined by $wp_query
add_filter( 'searchwp_force_wpquery_order', '__return_true' );
view raw functions.php hosted with ❤ by GitHub


Parameter Type Description
$force Boolean

Whether to force sort order as defined by wp_query