WordPress.org

Ready to get started?Download WordPress

Forums

Getting the permalink from a variable. (1 post)

  1. chibib0
    Member
    Posted 2 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic