From ea0e671f4ce0fe4990a55813f8bd9ea30f497a2e Mon Sep 17 00:00:00 2001 From: Antoine M Date: Wed, 13 Dec 2023 11:18:03 +0100 Subject: [PATCH] handling exposed post types in search --- includes/search.php | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 includes/search.php diff --git a/includes/search.php b/includes/search.php new file mode 100644 index 0000000..9e36ee3 --- /dev/null +++ b/includes/search.php @@ -0,0 +1,9 @@ +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');