Excluding Pages From Search Results

2 months ago | fatihturan (Member) | |

Hello.

How i can exclude all pages from search results?

My Search Unleashed settings is here: http://uploads.screenshot-program.com/upl9538868281.png

I unchecked "Pages" but plugin is continue indexing all pages.

Thanks.

Read responses...

Responses

  1. John:

    Posted 2 months ago by Key Master

    Added to the bug tracker. What version of WP are you using?

  2. fatihturan:

    Posted 2 months ago by Member

    I'm using WP 2.6.1

  3. John:

    Posted 2 months ago by Key Master

    If you change any setting in SU then you need to re-create the index. If you don't do this you will still have all the pages in from before the change of setting.

  4. jeeremie:

    Posted 1 month ago by Member

    add this to functions.php:

    // Remove pages from search
    function mySearchPostsFilter($query)
    {
    if ($query->is_search)
    {
    $query->set('cat','12,14,16,17,18');
    }
    return $query;
    }
    add_filter('pre_get_posts','mySearchPostsFilter');

    Find out what are your categories IDs and replace '12,14,16,17,18' by yours.

  5. author
    huski:

    Posted 1 month ago by Member

    I am having problems trying to get only posts to search, not pages
    my settings are:

    Include: PAGES (unchecked) POSTS (checked)
    re-indexing the search, pages and posts show up

    Pages to exclude: 2,2416,2430
    re-indexing the search, pages and posts show up

    any suggestions, thanks

  6. John:

    Posted 2 weeks ago by Key Master

    Added to bug tracker

Reply

You must log in to post.

Home | Software | Terms & Conditions | Sitemap | John Godley © 2008