Title: category number
Last modified: August 20, 2016

---

# category number

 *  [inigo](https://wordpress.org/support/users/inigo/)
 * (@inigo)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/category-number-1/)
 * Hi
    Which wp function can I use to fetch the category number on a page? e.g. 
   if url being mydomainname/blog/cat=146, I want to retrieve 146
 * Of coarse, it can be done with a preg_match on the $_SERVER[‘REQUEST_URI’] but
   I like to use custom WP functions.
 * Goal: highlight the active class in the WP category list
    -  by using the current_category= argument.
 * thx

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/category-number-1/#post-2935871)
 * You can use the [get_query_var() function](http://codex.wordpress.org/Function_Reference/get_query_var)
   to do that.
 *  Thread Starter [inigo](https://wordpress.org/support/users/inigo/)
 * (@inigo)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/category-number-1/#post-2935878)
 * Hi vtxyzzy,
 * thx for your reply.
    I looked and tried to retrieve the the id by $cat_Id = get_query_var(‘
   cat’); Nope… But did I make clear that I am on a page which displays all posts
   in a certain category? I am not on a post page. It looks like get_query_var is
   more suitable for that situation.
 * grtz I.
 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/category-number-1/#post-2935879)
 * Try using this:
 *     ```
       $cat = $_GET['cat'];
       ```
   
 *  Thread Starter [inigo](https://wordpress.org/support/users/inigo/)
 * (@inigo)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/category-number-1/#post-2935886)
 * YEAH! super simple and working. Great
 * BTW I used regular quotes. Otherwise I get errors.
 * thx a lot!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘category number’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [inigo](https://wordpress.org/support/users/inigo/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/category-number-1/#post-2935886)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
