• Hello everyone,
    I’m very new to creating plugins to WP and l’ve been working through the codex tutorials. I’ve come to a point where l’d like to give the user the ability to modify the blogname and blogdescription from my custom plugin. I know these fields are already available in the general settings section, but just for the sake of learning lets say there was a good reason for wanting to do this.

    Now in my plugin’s settings page l have:

    <form method="post" action="options.php">
    <?php settings_fields( 'baw-settings-group' ); ?>
    Blog Name<input name="blogname" type="text" id="blogname" value="<?= get_option('blogname'); ?>" class="regular-text" />
    Adsense code: <input name="bh_adsense_code" type="text" id="bh_adsense_code"  value="<?php echo get_option('bh_adsense_code'); ?>" class="regular-text" />
    <input type="hidden" name="save" value="true" />
    <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />

    When l change the values of the two fields, the bh_adsense_code gets’ updated, but the blogname does not, can anyone explain why that is, and help me with a work around?

    Thanks to anyone who can help!

Viewing 1 replies (of 1 total)
  • Thread Starter jspicher

    (@jspicher)

    Disregard, l figured it out. I needed to add:

    register_setting( 'baw-settings-group', 'blogname' );
    In my register_mysettings() function.

Viewing 1 replies (of 1 total)
  • The topic ‘Updating "blogname" from a plugin’ is closed to new replies.