I was working on a wordpress theme project, where i implemented theme options page. Thought that there needs to be a feature to reset all theme values, when a button is clicked. It didn’t work, when i put-up a Reset button, near the submit button on the same form in the wordpress. It turns out i have to include a separate form for this to do the trick. Don’t forget that you can create buttons using wordpress submit_button() function

Here is a snippet of code that does the trick.

<h1>Reset Defaults</h1>
<form method="post" action="">
 <p class="submit">
 Load theme default settings: <input name="reset" class="button button-secondary" type="submit" value="Reset to theme default settings" >
 <input type="hidden" name="action" value="reset" />
 </p>
</form>

Then you write code to do the task when the button is clicked.

if(isset($_POST['reset'])) {
 update_option('mytheme-options', mytheme_defaults() );
 echo '<p style="color:red">Theme settings have been reset and default values loaded</p>'; 
}

The function my theme_defaults() contains an array of default values required for the theme. For example

function my theme_defaults() {
$defaults = array (
 'logo' => '',
 'favicon' => '',
 'footer' => '',
 'facebook-link' => '',
 'twitter-link' => '',
 'google-plus-link' => '',
 'pin-it-link' => '',
 'linkedin-link' => '',
 'showcase-image' => '',
 'showcase-title' => '',
 'showcase-text' => '',
 'showcase-link' => '',
 'menu-color' => '#caeffc',
 'header-color' => 'transparent',
 'menu-font-color' => '#333',
 'widgets-menus-color' => 'transparent',
 'footer-color' => '#b7d3e5',
 'link-color' => '#000',
 'bg-color' => 'transparent',
 'showcase-color' => '#f5fefe',
 'showcase-font-color' => '#777',
 'showcase' => '1',
 'comments' => '1',
 'reset' => '0'
 );

return $defaults; 

}