Help me display the ID of the category in the functions.php file
In the functions.php file I need to retrieve the id of a cateory however I have used many different functions but it still does not work.
The function I use
foreach (get_the_category () as $ category)
$ id = $ category-> cat_ID;}
I also tried to use
$ id = get_query_var (‘cat’);
However all is not working in functions.php file
If you put it in file category.php, it worked.
But what I need it to work in the functions.php file
Is there any way to make it work without you.
[ do not bump – it is not permitted on these forums ]
- The topic ‘Help me display the ID of the category in the functions.php file’ is closed to new replies.