WP 3.4 – what action/hook is called when theme customisation is saved?

The settings are saved via ajax, with the action customize_save. In the wp-includes/class-wp-customize-manager.php class, the callback for this ajax method is the save method (see source)

This triggers the customize_save action, prior to updating each of the settings.

Each setting is actually an instance of the class WP_Customize_Setting and saving the setting triggers the action

customize_save_{$setting_id}

if you wanted to trigger the action when a particular setting is saved (unfortunately there’s no filter).

The save method calls the update method, which behaves different depending on whether the settings is a ‘theme_mod’ or ‘option’. Regardless they are both saved using update_option (and so passed through the appropriate filters). The former is done so via set_theme_mod().

Leave a Comment