Support » Plugins and Hacks » Exclude pages from being searched

  • Resolved TomJohnson

    (@tomjohnson)


    I would like to exclude certain pages from being searched. More specifically, I would like to exclude pages from being served up in the Related Entries section of the Related Entries plugin. How do I do that?

Viewing 11 replies - 1 through 11 (of 11 total)
  • If a plugin is showing Pages in posts list… it means it is not compatible with the 2.1.x branch.

    Thanks HandySolo and rudolf45. I checked the Related Entries plugin and it doesn’t say that it isn’t compatible with 2.1.2.

    How hard is it to tweak the plugin to make it compatible? It seems like a really popular plugin (or one that is at least really useful).

    If I were to insert the <!– google_ad_section_start(weight=ignore) –>

    before and after the pages I want to be ignored in the Related Entries plugin, would that work? Do I have any other options? I really like the plugin.

    I found this page about 2.1 SQL changes but I have no clue how to implement it.

    Man, my initial answer was way off. Apologies for that.

    I was vague with my question. I checked out your site and see that you’re using a Related Posts plugin. I think it’s ultimate tag warrior. Does that work with 2.1.2? Also, do you have to manually enter keywords for that plugin to work, or does it automatically match related posts based on keywords?

    UTW does the related posts via the tags. And yep, I enter the tags for each article. In general, I find the results to be rather similar to the w-a-s-a-b-i related posts plugin, but since I’m already running UTW…

    I had played around with the wasabi one and 2.1, thought it was working. Let me re-download it and have a quick look at the queries.

    ok… looking at version 2.0.4, around line 88 we find:

    $sql = "SELECT ID, post_title, post_content,"
             . "MATCH (post_name, post_content) "
             . "AGAINST ('$terms') AS score "
             . "FROM $wpdb->posts WHERE "
             . "MATCH (post_name, post_content) "
             . "AGAINST ('$terms') "
    		 . "AND post_date <= '$now' "
             . "AND (post_status IN ( 'publish',  'static' ) && ID != '$post->ID') ";

    Try changing that to:

    $sql = "SELECT ID, post_title, post_content,"
             . "MATCH (post_name, post_content) "
             . "AGAINST ('$terms') AS score "
             . "FROM $wpdb->posts WHERE "
             . "MATCH (post_name, post_content) "
             . "AGAINST ('$terms') "
    		 . "AND post_date <= '$now' "
             . "AND (post_type = 'post') AND (post_status IN ( 'publish',  'static' ) && ID != '$post->ID') ";

    Holy Smokes! You totally fixed it. Thank you so much! Now I don’t see any more pages in the Related Links. Again, I really appreciate your help.

    Rock on – glad it worked! (’cause now is when I confess I hadn’t actually tested it…) 😀

    I added some info about the contextual related entries plugin here on the comments of my blog (look near the bottom).

    It provides an alternative to the wasabi plugin.

    My post is here.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Exclude pages from being searched’ is closed to new replies.