Skip to main content

Framework core hooks

Lifecycle, boot, and cross-cutting hooks fired by the framework core (the fw() runtime, the bootstrap, the dynamic-content and CSS pipelines). These are the hooks you reach for when you need to run code at a specific point in the framework's load, or to alter framework-wide behavior.

The single most useful one is fw_init — it fires once the framework is fully loaded and every component (fw()->extensions, fw()->theme, fw()->backend) is safe to touch:

add_action( 'fw_init', function () {
// Safe to call any fw() API here.
$value = fw_get_db_settings_option( 'some_option' );
} );

The boot order is fw_before_initfw_extensions_before_initfw_extensions_initfw_init; see How the framework boots for the full sequence.

Actions (21)

HookPasses to your callbackWhat it does
fw_after_plugin_activateunysonplus/unysonplus.php
fw_automatic_update_complete$plugin->resultunysonplus/unysonplus.php
fw_before_initunysonplus/framework/bootstrap.php
fw_customizer_options_updatesee source(@since 2.6.0)
fw_form_display_errors_frontend$formUse this action to customize errors display in your theme
fw_form_display:after$thisunysonplus/framework/helpers/class-fw-form.php
fw_form_display:after_form$thisunysonplus/framework/helpers/class-fw-form.php
fw_form_display:before$thisunysonplus/framework/helpers/class-fw-form.php
fw_form_display:before_form$thisunysonplus/framework/helpers/class-fw-form.php
fw_initThe framework is loaded
fw_plugin_activateunysonplus/unysonplus.php
fw_plugin_post_updateAfter plugin successfully updated
fw_plugin_pre_updateBefore plugin update The plugin was already downloaded and extracted to a temp directory and it's right before being replaced with the new downloaded version
fw_post_options_updatesee source(@since 2.2.8)
fw_settings_form_rendersee sourceunysonplus/framework/helpers/class-fw-settings-form.php
fw_settings_form_reset$old_values, $new_valuesunysonplus/framework/helpers/class-fw-settings-form.php
fw_settings_form_saved$old_values, $new_valuesLet the framework / theme react (cache flush, regenerated assets, etc.).
fw_settings_options_updatesee source(@since 2.6.0)
fw_term_options_updatesee source(@since 2.6.0)
fw:option-storage-types:register$registerunysonplus/framework/helpers/fw-storage.php
fw:settings-form:$old_values, $new_valuesunysonplus/framework/helpers/class-fw-settings-form.php

Filters (20)

HookPasses to your callbackWhat it does
fw_customizer_options$this->get_options( 'customizer' )unysonplus/framework/core/components/theme.php
fw_framework_customizations_dir_rel_path'/framework-customizations'unysonplus/framework/helpers/general.php
fw_framework_manifest_pathfw_get_template_customizations_directory( '/theme/manifest.php' )unysonplus/framework/core/components/theme.php
fw_get_db_post_option:fw-storage-enabledsee sourceunysonplus/framework/helpers/database.php
fw_google_fonts$fontsunysonplus/framework/helpers/general.php
fw_option_value_error$error, $id, $input_value, $optionAuthoritative server-side custom validation: uniqueness, existence, external API checks, cross-field rules, … Registered in PHP (NOT in the option array) so it can't be tampered with via the modal save payload. Return a non-empty string to mark the field invalid, or the unchan...
fw_plugin_action_list$actionsunysonplus/unysonplus.php
fw_post_options:$post_type$this->get_options( 'posts/' . $post_type )unysonplus/framework/core/components/theme.php
fw_settings_form_reset:valuesarray(), $old_valuesunysonplus/framework/helpers/class-fw-settings-form.php
fw_settings_form_textssee sourceunysonplus/framework/helpers/class-fw-settings-form.php
fw_settings_options$this->get_options( 'settings' )unysonplus/framework/core/components/theme.php
fw_taxonomy_options:$taxonomy$this->get_options( 'taxonomies/' . $taxonomy )unysonplus/framework/core/components/theme.php
fw_theme_config$configFilter the resolved theme config after the theme's own config.php (and child-theme override) have been merged in. Lets plugins set framework-level defaults like settings_form_side_tabs on generic themes that don't ship their own theme/config.php. Filter runs once per request...
fw_use_sessionstrueunysonplus/framework/helpers/class-fw-session.php
fw:backend-option-view:design-default:desc-under-labelfalseFixes https://github.com/ThemeFuse/Unyson/issues/2143 (@since 2.6.9)
fw:backend-option-view:design-default:responsive-classessee sourceunysonplus/framework/views/backend-option-design-default.php
fw:dynamic-content:permalink_choices_limit200Max items listed per post type (keeps a huge type from making a giant dropdown). Filterable for sites that want more / fewer.
fw:dynamic-content:tagsarray()Register Dynamic Content tags. @param array $tags Keyed by tag id. Each value is an array: 'label' => (string) label shown in the picker 'group' => (string) picker group heading 'params' => (array) optional param descriptors, each: array('id'=>'key','label'=>'Fiel...
fw:form:nonce-name-data'', $this, $render_dataunysonplus/framework/helpers/class-fw-form.php
fw:options-default-values:skip-typessee sourceunysonplus/framework/helpers/class-fw-db-options-model.php