0

Following this tutorial (same code as that one) I created an options page that works well, I can retrieve option values from my templates.

However when visting the option page in the dashboard, the fields remain empty although I've set their default value if they have one. Here's my code:

add_action('admin_menu', 'add_global_custom_options');
function add_global_custom_options() {
    add_menu_page( 'Theme Options', 'Theme Options', 'manage_options', 'functions','global_custom_options','', 83 );
}
function global_custom_options() {
?>
    <div class='wrap'>
        <h2>Themes Options</h2>
        <form method='post' action='options.php'>
            <?php wp_nonce_field( 'update-options' ); ?>
            <p>
                <strong>Footer information</strong>
                <br />
                <textarea name='footer_info' value='<?php echo get_option( "footer_info" ); ?>' /></textarea>
            </p>
            <p>
                <strong>Footer credit line</strong>
                <br />
                <textarea name='footer_credit' value='<?php echo get_option( "footer_credit" ); ?>' /></textarea>
            </p>
            <p>
                <input type='submit' name='Submit' value='OK' />
            </p>
            <input type='hidden' name='action' value='update' />
            <input type='hidden' name='page_options' value='footer_info, footer_credit' />
        </form>
    </div>
<?php
}

What am I doing wrong?

1 Answer 1

1

Textarea is different from textbox. The value is between the tags.

Try:

<textarea name='footer_info'><?php echo get_option( "footer_info" ); ?></textarea>
1
  • What a shameful mistake, I'd almost delete the question :D
    – drake035
    May 24, 2015 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.