Support » Plugin: Related Posts by Taxonomy » Trouble with custom taxonemy

  • I’m having a problem with a custom taxonomy using the following shortcode:
    [related_posts_by_tax exclude_terms=”3411,3412,3413″ taxonomies=”sfcategory”]

    Below, I’ve posted the selected terms from two different artciles under the sfcategory taxonomy. I don’t want it to relate off the parent term (which in this case is Services) so I’m trying to exclude that one. And it is one of the term id’s in my shortcode above.

    -Services
    –Heat Treating
    –Surface Hardening
    –Other Heat Treating Services
    –Gear Blanks
    –Rolled Rings
    –Gear Steel

    -Services
    –Plactic/Polymer Gears
    –Metal to Plastic Conversion
    –Plastic/Polymers
    -Raw Materials

    But I’m not sure it’s paying attention to this taxonomy at all. I feel like it’s relating based off of “category”. I have a category called “features” and all of the articles displaying on the article I’m testing with are from that category. Do I have to exclude that taxonomy somehow? I just want the article to relate based on the taxonomy “sfcategory”.

    I’m really stuck on this. So thanks in advance for any help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author keesiemeijer

    (@keesiemeijer)

    Hi rthomas2895

    Try it with the code example found here
    https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/recipes/#excluding_terms

    It’s not strictly excluding posts with the exclude_terms, it’s querying for posts with the remaining terms after excluding terms.

    Thanks for the reply!

    However, it’s still not working for me. I think it’s related based of the taxonomy “category” instead of “sfcategory”. Is there anything else I should maybe be looking at, or might be doing wrong?

    This is the shortcode I’m using…

    [related_posts_by_tax exclude_terms=”3411,3412,3413″ taxonomies=”sfcategory”]

    Or I’m using a simpler version of the shortcode and putting the exclusions in the code below in the function file.

    function related_posts_exclude_terms_widget( $args ) {
    // Example to exclude terms with ids 23 and 27 for the widget

    // change the term ids you want to exclude here
    $args[‘exclude_terms’] = array( 3411, 3412, 3413 );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trouble with custom taxonemy’ is closed to new replies.