Car Demon Code Docs

  1. Home
  2. Car Demon Code Docs
  3. Actions
  4. cd_settings_update_action


This action gets called when the Car Demon settings are updated. The call happens directly after the settings have been updated.

If you have created your own settings area using the ‘cd_settings_action‘ then you can use this action to save your settings.

do_action( ‘cd_settings_update_action’ );

add_action( 'cd_settings_update_action', 'my_update' );
function my_update() {

    if ( isset( $_POST['my_setting'] ) ) {

        $value = sanitize_text_field( $_POST['my_setting'] );

        global $car_demon_options;
        $car_demon_options['my_setting'] = $value;
        update_option( 'car_demon_options', $car_demon_options );



The above example checks to see if a form field named “my_setting” has been submitted. If found it sanitizes the value, then it grabs the global $car_demon_options, adds a new key to it called ‘my_setting’ and then re-saves theĀ settings using update_option().

Was this article helpful to you? Yes No

How can we help?