• Hi, I have several custom taxonomies in my wordpress site and would like to completely exclude one of them for certain reasons from building a json breadcrumb trail in the of the page.

    My current code I want to exclude looks like this:

    <script type="application/ld+json">
    {"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"https://www.mydomain.com","name":"mydomain.com"}},{"@type":"ListItem","position":2,"item":{"@id":"https://www.mydomain.com/mytaxonomy/","name":"Mytaxonomy"}},{"@type":"ListItem","position":3,"item":{"@id":"https://www.mydomain.com/mytaxonomy/term/","name":"Term"}}]}</script>

    When I delete the code for this taxonomy in the Breadcrumb NavXT settings, beginning with

    <span property="itemListElement" typeof="ListItem"><a property="item" typeof="WebPage" ...

    the code is still there after saving the settings.

    Is there a way to exclude this taxonomy, and if so, how?

    Thanks in advance!
    Andreas

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

    (@mtekk)

    The breadcrumb templates aren’t used in the JSON-LD formatted output, so changing the template isn’t going to affect that output at all. Instead, you have a few options:

    1. You can change the taxonomy/hierarchy that Breadcrumb NavXT uses for the post type. This can be done within the Breadcrumb NavXT settings page under the “Post Types” tab. This will cause Breadcrumb NavXT to use a different hierarchy for the post type (and not use the undesired taxonomy).
    2. You can use the bcn_after_fill action to iterate through the bcn_breadcrumb objects, removing the ones you don’t want.
    3. You can use the bcn_pick_post_term filter to set the term/taxonomy that Breadcrumb NavXT uses for the post (if there are multiple options) if this is a hierarchical taxonomy you are dealing with.
    4. You can use the bcn_post_terms filter to control what term(s) are displayed when the taxonomy is a non-hierarchical taxonomy.

    Note that these options will apply to all breadcrumb trails generated Breadcrumb NavXT, so if you’re tying to leave things out of only the JSON-LD version, while displaying the taxonomy/term in the breadcrumb trail the user sees. If you wan to just affect the output of bcn_display_json_ld, your best bet is to have it return a string instead of echoing (set the first parameter to true when calling the function) and then use the PHP JSON functions to modify the JSON object.

    Thread Starter Andreas 2013

    (@andreas-2013)

    Hi John, thank you very much!

    Unfortunately I don’t know how to manage the hooks, because on the linked pages there are no detailed informations for using them. Where can I find more informations and examples about the hooks and their usage?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.