WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Exclude pages from being searched (12 posts)

  1. TomJohnson
    Member
    Posted 7 years ago #

    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?

  2. Chris_K
    Member
    Posted 7 years ago #

  3. rudolf45
    Member
    Posted 7 years ago #

    If a plugin is showing Pages in posts list... it means it is not compatible with the 2.1.x branch.

  4. TomJohnson
    Member
    Posted 7 years ago #

    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.

  5. TomJohnson
    Member
    Posted 7 years ago #

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

  6. Chris_K
    Member
    Posted 7 years ago #

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

  7. TomJohnson
    Member
    Posted 7 years ago #

    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?

  8. Chris_K
    Member
    Posted 7 years ago #

    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.

  9. Chris_K
    Member
    Posted 7 years ago #

    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') ";
  10. TomJohnson
    Member
    Posted 7 years ago #

    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.

  11. Chris_K
    Member
    Posted 7 years ago #

    Rock on - glad it worked! ('cause now is when I confess I hadn't actually tested it...) :-D

  12. TomJohnson
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic