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: 1.9

searchwp_force_run

By default SearchWP will only hijack the array of posts objects returned if these conditions are met:

  • Not in the WordPress Admin (is_admin())
  • A search is taking place (is_search())
  • It is the main query (is_main_query())

If you would like to override the second item in that list, add the following to your theme’s functions.php:

<?php
add_filter( 'searchwp_force_run', '__return_true' );
view raw gistfile1.php hosted with ❤ by GitHub

You will only want to use this filter in the context of some other condition being met, else SearchWP will fire for every WP_Query that takes place.

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