Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created December 27, 2018 21:43
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 billerickson/05b9e62678489f36373b2543602a7aa7 to your computer and use it in GitHub Desktop.
Save billerickson/05b9e62678489f36373b2543602a7aa7 to your computer and use it in GitHub Desktop.
<?php
/**
* SearchWP Related on specific post types
* @see https://www.billerickson.net/code/searchwp-related-on-specific-post-types/
*/
function ea_searchwp_related_exclude( $exclude = array() ) {
$allowed = array( 'post', 'resource' );
$all = array_keys( get_post_types() );
return array_diff( $all, $allowed );
}
add_filter( 'searchwp_related_excluded_post_types', 'ea_searchwp_related_exclude' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment