Title: Code/tag for getting current URL?
Last modified: August 19, 2016

---

# Code/tag for getting current URL?

 *  [Scott Chandler](https://wordpress.org/support/users/scott-chandler/)
 * (@scott-chandler)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/codetag-for-getting-current-url/)
 * Hi
 * Is there a tag for getting the URL of whatever page a blog reader is currently
   viewing?

Viewing 1 replies (of 1 total)

 *  [coopersita](https://wordpress.org/support/users/coopersita/)
 * (@coopersita)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/codetag-for-getting-current-url/#post-1831259)
 * I don’t know of a specific WordPress tag for that, but php can do it:
 *     ```
       <?php
       echo $_SERVER['PHP_SELF'];
       ?>
       ```
   
 * From the php documentation on php_self: The filename of the currently executing
   script, relative to the document root. For instance, $_SERVER[‘PHP_SELF’] in 
   a script at the address [http://example.com/test.php/foo.bar](http://example.com/test.php/foo.bar)
   would be /test.php/foo.bar.

Viewing 1 replies (of 1 total)

The topic ‘Code/tag for getting current URL?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [coopersita](https://wordpress.org/support/users/coopersita/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/codetag-for-getting-current-url/#post-1831259)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
