This is not a good solution, but it’s a quick and dirty way to do the job, along the lines of some of the code examples from the WP documentation on The Loop.
So first, in the functions.php file in your theme, add this function:
function is_type_page() { // Check if the current post is a page
global $post;
if ($post->post_type == 'page') {
return true;
} else {
return false;
}
}
Next, in your search.php file in your theme (where your search results are displayed, you want to add the following line right after the loop. It should look like this:
<?php while (have_posts()) : the_post(); ?>
<?php if (is_type_page()) continue; ?>
That *will* exclude pages from your search results. (At least it does work for me, on WP 2.5.1.)
The reason I dislike it is that it simply removes the pages from your result set. So let’s say you have WP set to show 20 posts per page, but on a given search result set 7 of the results are pages. The result set displayed to the user will be 13 instead of 20! That’s ugly.
One thing you might consider to also prevent against this would be to give your pages a very early publish date, assuming you don’t use the publish date anywhere. This would ensure that at a minimum they always show up at the end of your result set, which would ameliorate the problems caused by the above.
If I hack together anything better than the above I will post it here.