Support » Plugin: Yoast SEO » Primary category not passed on to query for slug

  • Resolved Boris


    I’m using Yoast SEO in combination with Ajax Load More plugin.

    Posts are in multiple categories, but each has its primary category configured, for example “Workshops”. However, when I visit the Workshops page (which is the category Workshops posts overview), all links to posts refer to the wrong category slug (alle-activiteiten), even though none of the posts have alle-activiteiten as their primary category.

    I’ve reached out to the ALM plugin makers, but they do not know how the primary category is ‘called’ by Yoast SEO. Here is the topic link:
    topic on ALM plugin page

    I also tried several options mentioned on a Yoast issue page on github which seems to touch on the subject: link to issue page on github.

    However, none of the suggestions work. I think the problem lies within this piece of code in the theme’s category.php file:

    $queried_object = get_queried_object(); 
    $taxonomy = $queried_object->taxonomy;
    $term_id = $queried_object->term_id;  
    $ajax_tag = '';
    $tags = array();
    $ajax_category = 'category="'.$queried_object->slug.'" ';

    The $ajax_category variable is later on referred in the ALM shortcode to call the slug. Can you help me figure out why this slug does not match the primary category? How should I call that within the category.php file?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Md Mazedul Islam Khan


    We can’t offer support on custom code (needed to change (core) features of our plugin). Since we don’t want to take the risk that we break your website by suggesting incorrect or incomplete code, we cannot advise you on how to make such changes. Maybe someone watching these forums can assist you further, but if your topic is inactive for 7 days, we’ll mark it as resolved to keep the overview.

    Thank you for your understanding.

Viewing 1 replies (of 1 total)
  • The topic ‘Primary category not passed on to query for slug’ is closed to new replies.