Skip to main content
Documentation/Developers/APIs/Hooks Reference/Saving

Saving

breakdance_after_save_document($postId) runs after the builder handler updates data and generates post cache. $postId is an integer; the action ignores returns.

PHP
add_action('breakdance_after_save_document', function ($postId) {
    wp_cache_delete((int) $postId, 'acme_document_summary');
});

Avoid recursive saves. Other WordPress/agent write paths may not invoke this hook.

Global Writes

These experimental filters receive true and return boolean; false skips the supplied resource's write in this handler:

Filter Resource
breakdance_save_global_settings Builder Global Settings.
breakdance_save_presets Design Presets.
breakdance_save_variables Variables.
breakdance_save_oxy_selectors The newer selector resource used by shared code.
breakdance_save_selectors The classes/selectors payload handled by save_selectors.
breakdance_save_ai_settings AI settings, when the saving API is available.
PHP
add_filter('breakdance_save_global_settings', function ($allow) {
    return current_user_can('manage_options') ? $allow : false;
});

They may change or disappear. They neither block the document tree nor cover separate resource APIs. Reload affected resources to confirm what persisted; handler-specific filters are not complete authorization.

Restrict Global Changes to One User

The canonical example allows only a specified WordPress user to save these resources. Replace 69420 with the intended user ID:

PHP
function my_extension_allow_global_save($allow) {
    return get_current_user_id() === 69420 ? $allow : false;
}

add_filter('breakdance_save_global_settings', 'my_extension_allow_global_save');
add_filter('breakdance_save_presets', 'my_extension_allow_global_save');
add_filter('breakdance_save_selectors', 'my_extension_allow_global_save');
add_filter('breakdance_save_ai_settings', 'my_extension_allow_global_save');

These filters run when saving in the builder. See the official editor save filters.