Search for: Log In Free Support [Resolved] How can I make search results only show posts not pages? 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 6 months, 2 weeks ago by David. Viewing 3 posts - 1 through 3 (of 3 total) Author Posts July 15, 2020 at 2:16 am #1364015 Robin 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 Robin 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. Documentation: http://docs.generatepress.com/ Adding CSS: http://docs.generatepress.com/article/adding-css/ 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