Title: getting current URI
Last modified: August 19, 2016

---

# getting current URI

 *  [affian](https://wordpress.org/support/users/affian/)
 * (@affian)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/getting-current-uri/)
 * Is there a way to compare the current location of the browser to a string?
    I
   have a link that I want to style differently if you are currently on that page.
   The page in question is a category page so the normal get_post_uri() won’t work.
 *     ```
       <li class="<?php if ($custom_menu['url'] == /*current URI*/) echo 'current_page_item'; ?>">
       <a href="<?php echo $custom_menu['url']; ?>">
       <?php _e($custom_menu['label'],TEMPLATE_DOMAIN); ?>
       </a>
       </li>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [affian](https://wordpress.org/support/users/affian/)
 * (@affian)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/getting-current-uri/#post-1331563)
 * ok I’ve narrowed it down because wp_list_categories() does what I want, it highlights
   the the current category using
    `$r['current_category'] = $wp_query->get_queried_object_id();`
 * I just can’t figure out how it does it, I’ve been digging through source code
   and just can’t find what I’m looking for.

Viewing 1 replies (of 1 total)

The topic ‘getting current URI’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [menu](https://wordpress.org/support/topic-tag/menu/)
 * [uri](https://wordpress.org/support/topic-tag/uri/)
 * [url](https://wordpress.org/support/topic-tag/url/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [affian](https://wordpress.org/support/users/affian/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/getting-current-uri/#post-1331563)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
