0

I wrote the following code, which works fine in displaying a hex value if its not set, or if its set already.

I want to save the selection of the colorpicker, using the save button, but something is wrong here - since once I press it, not only it is not saved, but an error regarding not found options.php comes back from WordPress.

I am wondering how to save the new selection.

<?php 

function my_overlay_callback() {

if( !isset( $options['textcolor'] ) ) add_option('textcolor', '#f48854'); 
echo '<input class="my-color-field" type="hidden" name="header_color" value="' . get_option('textcolor') . '"/>';

}

?>

<div class="wrap">


       <?php my_overlay_callback(); ?>


    <form method="post" action="options.php">
    <?php
    settings_fields("textcolor");
    do_settings_sections("textcolor");

?>
     </form>

</div>

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.