Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14611 reviews 1734 hosting providers

Questions & Answers

WordPress categories issue

Sep 21, 2013 by DinoGuy
Hi there
I would appreciate any help on this as I couldn’t find an answer anywhere..
When I am on a category page  like www.mydomain.com/cetegory/uncategorized , it’s very simple to get the category ID of my current category. I can simply use get_query_var( 'cat' )
However I want to get all categories IDs and slugs. When I use a number of categories on tmy category page like this:
http://www.mydomain.com/?category_name=cat1+cat2+cat3
The category page however lists only the first category name (ie cat1)
How can I make the category page lists all categories?
Can anyone please help?
Thanks

1 Answer

0 votes
Sep 21, 2013 by WebProX
If you want to get the query variables as they are in the URL you can  use $wp_query
You can also get your category names using this code
global $wp_query;
$wp_query->query['category_name']