Title: retrieve variable from URL &#8211; $_GET
Last modified: August 22, 2016

---

# retrieve variable from URL – $_GET

 *  [brubble51a](https://wordpress.org/support/users/brubble51a/)
 * (@brubble51a)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/retrieve-variable-from-url-_get/)
 * Hi,
 * complete newbee here 🙂
 * I need to get a variable from the url – Read all the posts here but was unable
   to get anything to work.
 * I am trying to set up a simple re-direct based on user capabilities. It’s all
   working with the exception of the variable I need out of the url called “entry”.
   IE entry=908 in this case.
 * Here is the url: [http://my-url/projects-edit/?frm_action=edit&entry=908](http://my-url/projects-edit/?frm_action=edit&entry=908)
 * Here is my code on the page:
    <?php if ( current_user_can(‘read_post’, 122) ){?
   > <div>/projects-edit/?nentry=<?php ($_GET[‘entry’] ?>)” target=”_self”>Back 
   to Project</div> <?php ; } else { ?> <div>/my-page/” target=”_self”>Back to My
   Page</div> <?php ;} ?>
 * Any suggestions, keeping it simple, would be greatly appreciated
    Thanks! G

Viewing 1 replies (of 1 total)

 *  [respectyoda](https://wordpress.org/support/users/respectyoda/)
 * (@respectyoda)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/retrieve-variable-from-url-_get/#post-5183939)
 * You can just use simple relative urls.
 *     ```
       <?php
       $the-entry = $_GET['entry'];
   
       if ( current_user_can('read_post', 122) ) { ?>
           <a href="/projects-edit/entry-<?php $the-entry; ?>/" >Back to Project</a>
       <?php } else { ?>
           <a href="/my-page/">Back to My Page</a>
       <?php } ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘retrieve variable from URL – $_GET’ is closed to new replies.

## Tags

 * [$_get](https://wordpress.org/support/topic-tag/_get/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [respectyoda](https://wordpress.org/support/users/respectyoda/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/retrieve-variable-from-url-_get/#post-5183939)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
