Last active
October 30, 2019 12:50
-
-
Save jchristopher/dd1a9ea4ec43eda4e3c565a38b895ef1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_searchwp_engine_settings_default( $settings, $query ) { | |
if ( empty( $_REQUEST['post_type'] ) ) { | |
return $settings; | |
} | |
$post_type_limiter = $_REQUEST['post_type']; | |
if ( ! post_type_exists( $post_type_limiter ) ) { | |
return $settings; | |
} | |
// limit results to one post type | |
foreach ( $settings as $post_type => $post_type_settings ) { | |
// account for (i.e. skip) the search engine label storage | |
if ( 'searchwp_engine_label' === $post_type ) { | |
continue; | |
} | |
$settings[ $post_type ]['enabled'] = ( $post_type == $post_type_limiter ) ? true : false; | |
} | |
return $settings; | |
} | |
add_filter( 'searchwp_engine_settings_default', 'my_searchwp_engine_settings_default', 10, 2 ); |
For support please open a ticket using the Support tab on the SearchWP settings screen, thank you!
Hi Christopher,
You mean on the github or in their website?
Thanks
…On Wed, Oct 30, 2019 at 9:03 AM Jon Christopher ***@***.***> wrote:
For support please open a ticket using the Support tab on the SearchWP
settings screen, thank you!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/dd1a9ea4ec43eda4e3c565a38b895ef1?email_source=notifications&email_token=AAFXO36OTOCFUZTW7GGPRYLQRDMO5A5CNFSM4JGQ5FO2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAF3K7C#gistcomment-3069425>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFXO33WSEIFG3TN4N62PB3QRDMO5ANCNFSM4JGQ5FOQ>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @jchristopher
We are using your plugin in our website but we wanted to limit the search results in one custom post type. How we can override the search logic via functions.php in our theme? Please advise.
Thank you very much.