Get REAL Category Name from Query Vars Outside Loop
-
I’m trying to get the real name and id of a category known as “hot-destinations” in my query vars.
This category would have the url: mywebsite.com/hot-destinations.
This page works, but all I can see in $wp_query->query_vars is “hot-destinations”. I would like to get the real name of this category without doing any fancy string transpositions (“Hot Destinations”) as well as its proper category id OUTSIDE of the post loop.
In my script, I do use
get_query_var('category_name')
to pull the category name, but found that my query vars were otherwise empty by doing a PHPvar_dump($wp_query->query_vars)
.This seems like a fairly simple task; I just can’t seem to figure out how to accomplish this.
- The topic ‘Get REAL Category Name from Query Vars Outside Loop’ is closed to new replies.