Reply To: "Title" keep field exclusive doesn't work, Help!

Home Forums Product Support Forums Related Posts Pro for WordPress Support "Title" keep field exclusive doesn't work, Help! Reply To: "Title" keep field exclusive doesn't work, Help!

#2095

Ernest Marcinko
Keymaster

Of course we can try. But please don't expect google-like relevance, the product is smart, but not as smart as google 😀

Okay, so what I understand is that you are interested in comparing the titles in a more “exact” way. What we should try is to change the query to look for exact title matches, and ignore the individual words from the title.

Open up the reladed-posts-pro/includes/related_content.class.php file. It's a huge file handling and building up the final quiery for the lookup.

On line 298-303 you should see something like:

  $like = implode(' OR ', $parts);
  if ($like == "")
      $like = "(1)";
  else {
      $like = "($like)";
  }

That's the part you don't really need anymore, instead let's change it to an exact title match thing:

  /*$like = implode(' OR ', $parts);
  if ($like == "")
      $like = "(1)";
  else {
      $like = "($like)";
  }*/
  $like = "(lower($wpdb->posts.post_title) LIKE '%".strtolower($post->post_title)."%')";

As you can see I just commented out the old code and added one line. The new line basically grabs the title and compares it to other post titles.

One last thing, this affect the non-fulltext lookups, sou you should disable the fulltext lookup (https://i.imgur.com/28Bp0mW.png) on the advanced options panel. Also the caching as well.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)