0

I have created a section field like this →

    // Logo Upload Option
add_settings_field(
    'logo_upload',                              // The ID (or the name) of the field
    'Upload the Header Logo',                   // The text used to label the field
    'upload_logo_field',                // The callback function used to render the field
    'theme-header-options',             // The page on which we'll be rendering this field
    'header_section'                            // The section to which we're adding the setting
);

Then created the callback function like this →

function upload_logo_field() {
    ?>
        <input type="file" name="logo" />
        <?php echo get_option('logo'); ?>
    <?php

Now I have created a Video here. It looks like that things are working, but actually I believe that I am still missing something?

I think it is still not saving into the database? I believe I need to add something else? Do I need to to create register_setting for every field or register_setting is for some sections only and should be done once for every section or register_setting is needed to be done for every add_setting_field?

  • I believe I am still not able to save it into the database, and I will be needing a function to do that, but where can I add that extra call back function? and what will I write in that extra call back function? – The WP Intermediate Jun 6 '17 at 8:54
  • In short what I am missing is saving this into the database. – The WP Intermediate Jun 6 '17 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.