Title: Getting the permalink from a variable.
Last modified: August 20, 2016

---

# Getting the permalink from a variable.

 *  [chibib0](https://wordpress.org/support/users/chibib0/)
 * (@chibib0)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/getting-the-permalink-from-a-variable/)
 * Hi,
 * I want to get the permalink from a given variable.
 * I have an option using the settings api in which users can input the slug of 
   a page.
 * What i wanted is to output the permalink of the slug inputted by users.
 * I have this,
 *     ```
       function mytheme_option( $option ) {
       	$options = get_option( 'mytheme_options' );
       	if ( isset( $options[$option] ) )
       		return $options[$option];
       	else
       		return false;
       }
       $termspage = mytheme_option('terms_slug');
       echo get_permalink($termspage);
       ```
   
 * However, it doesn’t output the permalink even the page of the inputted slug exists.
 * Please help

The topic ‘Getting the permalink from a variable.’ is closed to new replies.

## Tags

 * [permalink](https://wordpress.org/support/topic-tag/permalink/)
 * [slug](https://wordpress.org/support/topic-tag/slug/)

 * 0 replies
 * 1 participant
 * Last reply from: [chibib0](https://wordpress.org/support/users/chibib0/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/getting-the-permalink-from-a-variable/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
