Support » Plugin: WordPress Related Posts » Exclude category doesn’t always work

  • Hi

    In one of our sites, we exclude all categories except one, but still, some posts from other categories sneak in. How can that be?

    Thank you

Viewing 1 replies (of 1 total)
  • I dug into the code, and found that in the wp_rp_generate_tags() function, the $tag_groups array is made up of 3 items: the 1st is based on post tags, the 2nd is based on categories, and the 3rd is based on unigrams.csv.
    It seems like the 3rd is the one that’s generating related posts from other categories. I don’t know why it happens only in one site, but I found that if I comment out this code from wp_rp_generate_tags() in recommendations.php, it solves the problem:

    'auto_tags' => array(
    	  'labels' => wp_rp_generate_auto_tags($post),
    	  'weight' => WP_RP_RECOMMENDATIONS_AUTO_TAGS_SCORE,
    	  'prefix' => 'A_',
      )

    Is there anything to do about this? Commenting out code is clearly not a good solution, but since I can’t seem to dig any deeper (it’s been quite a dig the way it is), I don’t know of a better way to to solve the problem.

Viewing 1 replies (of 1 total)
  • The topic ‘Exclude category doesn’t always work’ is closed to new replies.