Title: Update option by function
Last modified: August 31, 2016

---

# Update option by function

 *  Resolved [alexcosta](https://wordpress.org/support/users/alexcosta/)
 * (@alexcosta)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/update-option-by-function/)
 * Hello and thanks for this **amazing work**.
 * Is it possible to update a value of a specific field on page load by a function
   or other mean?
 * I have a toggle that, when checked, shows hidden (required) fields.
    I would 
   like this toggle to be always unchecked by default so that the hidden fields 
   only show when user clicks the toggle.
 * Is there a way to do this?
 * Many thanks
    Alex
 * [https://wordpress.org/plugins/kirki/](https://wordpress.org/plugins/kirki/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Ari Stathopoulos](https://wordpress.org/support/users/aristath/)
 * (@aristath)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/update-option-by-function/#post-7076875)
 * Hey there!
 * you can try adding something like this:
 *     ```
       add_action( 'customize_save_after', function() {
         set_theme_mod( 'my_setting', 0 );
       });
       ```
   
 *  Thread Starter [alexcosta](https://wordpress.org/support/users/alexcosta/)
 * (@alexcosta)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/update-option-by-function/#post-7076876)
 * Works like a charm!
 * Thank you very much!
 *  [Ari Stathopoulos](https://wordpress.org/support/users/aristath/)
 * (@aristath)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/update-option-by-function/#post-7076877)
 * 🙂 I’m glad I could help.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Update option by function’ is closed to new replies.

 * ![](https://ps.w.org/kirki/assets/icon-256x256.jpg?rev=3518366)
 * [Kirki – Freeform Page Builder, Website Builder & Customizer](https://wordpress.org/plugins/kirki/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/kirki/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/kirki/)
 * [Active Topics](https://wordpress.org/support/plugin/kirki/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/kirki/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/kirki/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Ari Stathopoulos](https://wordpress.org/support/users/aristath/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/update-option-by-function/#post-7076877)
 * Status: resolved