Return to Snippet

Revision: 30596
at August 18, 2010 01:35 by myke

Initial Code
 *Only Search Posts
function SearchFilter($query) {
    if ($query->is_search) {
        $query->set('post_type', 'post');
    return $query;


Initial URL

Initial Description
To exclude pages from wordpress search results include the following in your theme's functions.php

Initial Title
Only search WP posts

Initial Tags
search, wordpress

Initial Language