Skip to content

Action & Filter Hooks

Michiel Tramper edited this page Dec 19, 2018 · 7 revisions

The framework utilizes some actions and filter hooks to which custom code may be added.

Action Hooks

Name Passed parameters Description
'wcf_before_field' $field The field properties Hooks just before a field is rendered
'wcf_after_field' $field The field properties Hooks just after a field is rendered

 

Filter Hooks

The filters allow to add custom icons, fonts, modify outputs of fields and saved values and prevent the enqueueing of scripts.

If you are altering filters, make sure you always return the first parameter :).

Name Passed parameters Description
'wp_custom_fields_sanitized_value' $return_value The sanitized value, $field_value The original value, $field The field properties Filters a value after it has been sanitized (during saving values)
'wp_custom_fields_css_properties' $properties The custom css properties, $field The field properties The custom css properties for a field that has a selector
'wp_custom_fields_datepicker_field_js' $boolean Defaults to true. If the Flatpicker JS should be loaded
'wp_custom_fields_location_field_js' $boolean Defaults to true. If the Google Maps JS should be loaded
'wp_custom_fields_select_field_js' $boolean Defaults to true. If the Select JS should be loaded
'wp_custom_fields_field_class' $class, The class, $field The field properties. The class that is used to display a field.
'wp_custom_fields_field_form' $form The field output, $field The field properties. The actual string output of a certain field.
'wp_custom_fields_icons' $icons The fonts array. The array of icons that are loaded by default in the icons field and possible other places. Filtering this value allows to add other icon sets.
'wp_custom_fields_fonts' $fonts The icons array. The array of fonts that are loaded by default in the typograph field and possible other places. Filtering this value allows to add other fonts.
'wp_custom_fields_frames' $types The datatypes. The datatypes that are supported, which refer to places custom fields can be added. Defaults to meta,options or customizer.
'wp_custom_fields_frame_' . $type $frames The frames. The frames with the actual array of frames, sections and fields. Describes all the sections and fields added for the type.