Created
June 9, 2021 17:24
-
-
Save patrickposner/1bedc1d9bbc98209d130fc6ceeb9dbca to your computer and use it in GitHub Desktop.
Adds FILR documents to the WordPress search.
This file contains hidden or 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 | |
/** | |
* Adds FILR documents to the WordPress search. | |
* | |
* @param object $query current query. | |
* @return object | |
*/ | |
function add_filr_to_search( $query ) { | |
if ( $query->is_search ) { | |
$query->set( 'post_type', array( 'post', 'page', 'filr' ) ); | |
} | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'add_filr_to_search' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment