Home › Forums › Support › How can I make search results only show posts not pages? This topic has 2 replies, 2 voices, and was last updated 5 years, 2 months ago by David. Viewing 3 posts - 1 through 3 (of 3 total) Author Posts July 15, 2020 at 2:16 am #1364015 RJ Hey there – Is it possible to make the default WP search results only show posts not pages? TIA July 15, 2020 at 2:20 am #1364021 RJ In case anyone else needs this… I just did a quick google search and found this PHP code which seems to have worked: //Exclude pages from WordPress Search if (!is_admin()) { function wpb_search_filter($query) { if ($query->is_search) { $query->set('post_type', 'post'); } return $query; } add_filter('pre_get_posts','wpb_search_filter'); } Source: https://www.wpbeginner.com/wp-tutorials/how-to-exclude-pages-from-wordpress-search-results/ July 15, 2020 at 4:06 am #1364120 DavidStaff Customer Support Glad to see you found the answer – and thanks for sharing. Author Posts Viewing 3 posts - 1 through 3 (of 3 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In