• Hello,
    I’m developing a theme in wordpress that’s making use of taxonomies (a first for me). I’ve created both the custom post type and the custom taxonomy for it that serves as a category of sorts. I’ve managed to sort all the parent taxonomies for the custom post type on the index page on my site, with each of them having a link to the page for said taxonomy, meant to work as a category listing of sorts using taxonomies.

    Now I need to list the children taxonomies (and in them I’ll need to list the items each of them has), but I’ve found it impossible. The link to the taxonomy page is something like this:

    https://localhost/mysite/?product-category=indoor-furniture

    Where “product-category” is the general taxonomy name and “indoor-furniture” is the name for the current taxonomy (category) I want to see the children of. However, most variables seem empty:

    – No $id to get the taxonomy ID
    – If I use get_the_id() to try and get the ID of the current taxonomy, I get the ID of any of the items belonging to it instead, which causes issues because a single item can belong to any number of taxonomies.
    – If I echo $taxonomy, I get “product-category”.

    I have no idea what I can do to get the current taxonomy ID or the slug for it so that I can perform a proper query that will give me the children taxonomies of it. Any help? I’ve been looking around for about two hours now with no luck at all.

    Thanks in advance,
    Tizzy

  • The topic ‘How to get the name of the current taxonomy item?’ is closed to new replies.