Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sw_custom_post_type_includes($query) {
- if(isset($query->query_vars['post_type'])) {
- if(is_search() && is_main_query() && $query->query_vars['post_type'] != 'nav_menu_item') {
- $query->set('post_type', $query->query_vars['post_type']);
- }
- }
- elseif(isset($_GET['post_type'])) {
- if(is_search() && is_main_query()) {
- $query->set('post_type', urldecode($_GET['post_type']));
- }
- }
- }
- add_filter('pre_get_posts', 'sw_custom_post_type_includes');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement