Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter jasperspeicher

    (@jasperspeicher)

    Now the search is showing pages as well. I have changed the function to this:

    // Add functionality to the custom search widget
    	public static function blog_search_filter($query) {
    		if ($query->is_search && !is_admin()) {
    			$post_type = array_key_exists('post_type', $_GET) ? $_GET['post_type'] : false;
    			if (!$post_type) {
    				$post_type = 'post';
    			}
    			$query->set('post_type', $post_type);
    		}
    		return $query;
    	}

    The main change in this second bugfix being the switch to “post” from “any”

    Thanks,
    Jasper

Viewing 1 replies (of 1 total)