0

I have managed to pull out all taxonomy terms stored on my WP site like this:

$terms = get_terms( 
             array (
                'taxonomy' => 'portfolio-category',
                'hide_empty' => false,
             ));   

print "<pre>";
print_r($terms);
print "</pre>";

This would give me something like this back:

[4] => WP_Term Object
    (
        [term_id] => 74
        [name] => Homepage Thumbnail
        [slug] => homepage-thumbnail
        [term_group] => 0
        [term_taxonomy_id] => 74
        [taxonomy] => portfolio-category
        [description] => 
        [parent] => 0
        [count] => 11
        [filter] => raw
        [term_order] => 0
    )

But what if I have a page like www.mysite.com/portfolio-category/homepage-thumbnail where portfolio-category is the taxonomy and homepage-thumbnail is the slug, as they are both in the URL is there a way I can grab the term_taxonomy_id for the current page?

user3574492
  • 6,225
  • 9
  • 52
  • 105
  • All is explained on this reply: http://stackoverflow.com/questions/12289169/how-do-i-get-current-taxonomy-term-id-on-wordpress – 2Fwebd Dec 03 '16 at 11:21
  • That gets the queried object, which is not what I want, I want to get the term_taxonomy_id based on the current page as the taxonomy slug is in the URL, at that point there is no queried object. – user3574492 Dec 03 '16 at 14:18

0 Answers0