Skip to content

Instantly share code, notes, and snippets.

@searchwpgists
Created March 29, 2022 13:45
Show Gist options
  • Save searchwpgists/d51f06493041fc37278cd307fddef00f to your computer and use it in GitHub Desktop.
Save searchwpgists/d51f06493041fc37278cd307fddef00f to your computer and use it in GitHub Desktop.
Restrict results to Posts and Pages for SearchWP's SWP_Query
<?php
// Restrict results to Posts and Pages for SearchWP's SWP_Query.
add_filter( 'searchwp\swp_query\args', function( $args ) {
$args['post_type'] = [ 'post', 'page' ];
return $args;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment