Note: You are viewing the documentation for Version 3View Version 4 Docs

Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

Available since: 2.8.16

searchwp_force_wpquery_order

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:

<?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

Parameters

Parameter Type Description
$force Boolean

Whether to force sort order as defined by wp_query

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP