Skip to content

Hooks ​

Without ACF active, each wpff/… hook below that ACF also has runs as acf/… too. See ACF compatibility.

HookTypePurpose
wpff/initactionRegister groups, options pages and blocks here.
wpff/register_field_typesactionAdd your own field type, a subclass of FreeformFields\Fields\AbstractField: $registry->register( new My_Field() ).
wpff/load_value, wpff/format_value, wpff/update_valuefilter( $value, $post_id, $field ). Also /type=…, /name=… and /key=… variants.
wpff/validate_valuefilter( $valid, $value, $field, $post_id ). Return a message string to reject the value. Also /type=, /name= and /key= variants.
wpff/prepare_fieldfilter( $field ), before the field is rendered. Return false to hide the field.
wpff/pre_update_valuefilterReturn false to skip saving a value.
wpff/save_postaction( $post_id, $errors ), after a form is saved.
wpff/save_field_group, wpff/delete_field_groupactionAfter a group is saved or deleted in the admin.
wpff/load_field_groupsfilterAll groups, before they are normalized.
wpff/location/matchersfilterCustom location rules: 'param' => fn( $rule, $screen ) => bool.
wpff/settings/save_json, wpff/settings/load_jsonfilterLocal JSON folders.
wpff/settings/{name}filterA setting value.
wpff/options_autoloadfilterWhether options page values are autoloaded.
wpff/capabilityfilterCapability needed to manage field groups. Default: manage_options.
wpff/acf_compatfilterWhether to define functions with ACF's names.
wpff/fields/google_map/api_keyfilterGoogle Maps API key. Return '' to use OpenStreetMap.
wpff/fields/google_map/tilesfilterTile server: [ 'url' => …, 'attribution' => … ].
wpff/fields/google_map/geocoder_urlfilterA Nominatim-compatible geocoder.
wpff/updates/enabledfilterWhether to check GitHub releases for plugin updates. Default true.
wpff/updates/manifest_urlfilterURL of the update manifest. Default: update.json of the latest release.

Examples ​

Reject a value:

php
add_filter( 'wpff/validate_value/name=isbn', function ( $valid, $value ) {
	if ( $value && ! preg_match( '/^[0-9-]{10,17}$/', $value ) ) {
		return 'Enter a valid ISBN.';
	}
	return $valid;
}, 10, 2 );

Hide a field from non-admins:

php
add_filter( 'wpff/prepare_field/name=internal_note', function ( $field ) {
	return current_user_can( 'manage_options' ) ? $field : false;
} );

GPL-2.0-or-later. Not affiliated with ACF or WP Engine.