• How do I turn off the display of pages in the search?

    I don’t like how it displays the whole page.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter pad

    (@pad)

    Any ideas?

    I am having this problem too, but can’t find any solution.

    Okay, I’ve figured it out. In search.php, before The Loop, i.e. before the call to have_posts(), you add the following:

    <?php $posts = query_posts($query_string . '&post_type=post'); ?>

    This will restrict the “posts” returned to only those that are actually posts.

    How is this not a toggle in the admin?

    people begged for years to have pages searchable, now that they are, everyone’s complaining ??

    personally I think you should be able to restrict the search to a category/post type/etc as part of the search form itself.

    WordPress 2.6

    file: /wp-includes/query.php

    line 836:
    edit | $q[‘post_type’] = ‘any’;
    change | $q[‘post_type’] = ‘post’;

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Disable searching of pages?’ is closed to new replies.