Last active
October 27, 2015 23:59
-
-
Save JustinSainton/13419ce3b786b1aa20e9 to your computer and use it in GitHub Desktop.
Include excerpts in searches
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 | |
add_filter( 'posts_search', function( $sql, $wp_query ) { | |
global $wpdb; | |
$sql .= "OR $wpdb->posts.post_excerpt LIKE '%s' AND $wpdb->posts.post_type NOT IN ('some-post-type', 'another-post-type')"; | |
return $sql; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment