Custom Post Type UI
[resolved] Taxonomy IDs (7 posts)

  1. myhero
    Posted 2 years ago #


    How can I see the ID of custom taxonomy 'Actors'?

    (assuming I've created such a custom taxonomy, with taxonomies within Actors)

    If I click on edit and I hover over it, I get "edittax=0" is this the ID?



  2. Michael Beckwith
    Plugin Author

    Posted 2 years ago #

    No, the "edittax" $_GET parameter isn't the ID for the taxonomy. I don't actually believe the taxonomies themselves get a numeral ID, I know the terms in the taxonomy do.

  3. myhero
    Posted 2 years ago #

    Ok, thank you

  4. markomitranic
    Posted 2 years ago #

    And how can we find out a term ID via the term slug? I am not able to do that for some time now. Thanks. :)

    $catID2 = get_term_by('macola_raid-2');
    $catID2 = $catID2->term_id;

    This is what i tried last after hours of searching, and it doesn't work.

  5. markomitranic
    Posted 2 years ago #

    Well, i guess i should have also added this. This is what i would use it for:
    For some reason, i really want the category slug to be forwarded via $_GET to the search code below. The code works if i define the ID myself (for testing purposes), but i need a way to extract the id from the slug that was forwarded :)

    $args = array('post_type'=> array( 'pro_artikl' ), $catID2, 'posts_per_page' => -1);

    I guess something is wrong with the line
    $catID2 = $catID2->term_id;
    because it returns nothing when echoed. Normal categories for example return their id with no problems after that line.

  6. markomitranic
    Posted 2 years ago #

    Hmm, my error. The $args line actually does not separate the "not searched IDs" as it should. i will open a new support topic for that.

    Can you please answer the ->ID question here anyway? :)

  7. Michael Beckwith
    Plugin Author

    Posted 2 years ago #

    You aren't passing in all of the right parameters to get_term_by(). It has 3 required.

    1. $field aka either 'slug', 'name', or 'id'
    2. $term aka the value you're wanting to search by
    3. $taxonomy aka category, post_tag, link_category or something custom

    You'll want to do

    $catID2 = get_term_by('name', 'macola_raid-2', 'FILL TAXONOMY HERE' );

    Just replace the "FILL TAXONOMY HERE" part with your actual taxonomy, I'm not sure what that is in your case. That should make it work and return something.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Post Type UI
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.