Cannot display settings field

A plugin with a settings page does not render its settings field rma_base_url. No errors are thrown. Page is created in Settings, heading and submit button are rendered.

Code:

add_action('admin_menu', 'remote_member_auth_menu');

function remote_member_auth_menu() {
    add_options_page('Remote Member Auth Options', 'Remote Member Auth', 'manage_options', 'rma', 'remote_member_auth_options');
}

function remote_member_auth_options() {
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    echo '<div class="wrap">' .
        '<h3>Remote Member Authnetication Settings</h3>' .
        '<form method="post" action="options.php">';
    settings_fields('rma_options');
    do_settings_sections('rma');
    echo '<input type="submit" value="Set base url">' .
        '</form>' .
        '</div>';
}

function register_rma_settings() {
    register_setting('rma_options', 'rma_base_url');
    add_settings_field('rma_base_url', 'Base URL', 'rma_base_url_string', 'rma');
}

add_action('admin_init', 'register_rma_settings');

function rma_base_url_string() {
    $options = get_option('rma_options');
    echo "<input id='rma_base_url' name='rma_options[rma_base_url]' size='40' type='text' value='{$options['rma_base_url']}' />";
}

Read more here: Cannot display settings field

Leave a Reply

Your email address will not be published. Required fields are marked *