handling exposed post types in search
This commit is contained in:
parent
4daf7b2643
commit
ea0e671f4c
9
includes/search.php
Normal file
9
includes/search.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
function tg_include_custom_post_types_in_search_results($query)
|
||||
{
|
||||
if ($query->is_main_query() && $query->is_search() && !is_admin()) {
|
||||
$query->set('post_type', array('questions', 'conseils', 'page', 'news', 'jobs'));
|
||||
}
|
||||
}
|
||||
add_action('pre_get_posts', 'tg_include_custom_post_types_in_search_results');
|
||||
Loading…
Reference in New Issue
Block a user