Reputation: 9653
I need to edit a template's header.php
file and I want to check if it has a taxonomy named "store". If so, then I need to extract it's tag_ID
.
When I edit the page (it's not a WordPress Page type) I can see these values in the admin url:
taxonomy=store&tag_ID=720
So I know there is a way but I'm having trouble getting any good results. I tried the
method detailed here to extract at least the tag_ID
but I'm getting NULL
:
$tag_id=get_query_var('tag_ID');
echo $tag_id; //NULL
Edit:
To be clear in regards to the tag_ID
because it may be confusing, all I really want is to get the unique id of the requested page so I figure seeing first if it has a taxonomy named "store" and then getting the right one using the tag_id
.
Upvotes: 0
Views: 543
Reputation: 3629
AS far as i understand your question, You should try this:-
$data = get_queried_object();
With this, you can get what page/post/taxonomy is being called.
Just print-out/var_dump this $data
variable, you will get full object of page/post/taxonomy.
Hope this may help you.
Upvotes: 2