Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created September 8, 2016 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/17f6b41381722e256abedab761ef43a9 to your computer and use it in GitHub Desktop.
Save jchristopher/17f6b41381722e256abedab761ef43a9 to your computer and use it in GitHub Desktop.
<?php
function my_searchwp_engine_customizations( $settings, $query ) {
// print_r( $settings ); // uncomment this line to see the settings structure
// print_r( $query ); // uncomment this line to see the query structure
// Check for Title-only search
if ( empty( $_REQUEST['searchwp_limit_to_title'] ) ) {
return $settings;
}
// Return the Titles Only engine settings
return SWP()->settings['engines']['titles_only']; // titles_only is the Supplemental Engine NAME (not label)
}
add_filter( 'searchwp_engine_settings_default', 'my_searchwp_engine_customizations', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment