Skip to content
WereldkundigGravity Forms WereldkundigGravity Forms add-on

Hooks

Filters to change what the add-on sends and when, generated from the plugin's source code.

Add these filters in a plugin, a must-use plugin or your theme’s functions.php. The list below is generated from the add-on’s source code, so it matches the code these docs were built from.

FilterUse
wk_api_base_urlThe API base URL, e.g. https://subdomein.domein.nl, from the settings or WK_API_URL.
wk_api_timeoutThe API request timeout in seconds. Default 10.
wk_gf_auto_map_fieldsWhether to auto-find Email / First name / Middle name / Last name when the feed has no mapping for that field, or the form has no feed. Default `false`.
wk_gf_refresh_fields_initial_delaySeconds until the first background refresh after the API becomes configured. Default one hour.
wk_gf_refresh_fields_recurrenceThe WP-Cron schedule of the background refresh: hourly (default), twicedaily, daily, or one added with cron_schedules.
wk_gf_subscribe_themesThe themes to subscribe to: theme ID => category option keys, none meaning the whole theme.
wk_gf_subscribe_themes_{$form_id}The themes to subscribe to for one form, e.g. wk_gf_subscribe_themes_3 for form 3. Runs after wk_gf_subscribe_themes.
wk_gf_subscriber_pre_subscribeThe subscriber fields sent to POST /v1/subscribe (email, first_name, middle_name, last_name, company, ...).
wk_gf_subscriber_pre_subscribe_{$form_id}The subscriber fields for one form, e.g. wk_gf_subscriber_pre_subscribe_3 for form 3. Runs after wk_gf_subscriber_pre_subscribe.

wk_api_base_url

The API base URL, e.g. https://subdomein.domein.nl, from the settings or WK_API_URL.

The settings page doesn't validate a filtered URL, but every request still refuses plain http except for localhost, *.localhost and *.test.

ParameterTypeDescription
$urlstring

wk_api_timeout

The API request timeout in seconds. Default 10.

ParameterTypeDescription
$timeoutint
$methodstringGET or POST.
$pathstring/v1/subscribe/fields or /v1/subscribe.

wk_gf_auto_map_fields

Whether to auto-find Email / First name / Middle name / Last name when the feed has no mapping for that field, or the form has no feed. Default `false`.

Return true to fill them from the first matching form field. While it is false, a form without a feed has no email address, so nothing is sent.

ParameterTypeDescription
$enabledbool
$formarray
$entryarray
$feedarray|null

wk_gf_refresh_fields_initial_delay

Seconds until the first background refresh after the API becomes configured. Default one hour.

Later runs follow wk_gf_refresh_fields_recurrence. Negative values count as 0.

ParameterTypeDescription
$delayint

wk_gf_refresh_fields_recurrence

The WP-Cron schedule of the background refresh: hourly (default), twicedaily, daily, or one added with cron_schedules.

Unknown schedule names fall back to hourly.

ParameterTypeDescription
$recurrencestring

wk_gf_subscribe_themes

The themes to subscribe to: theme ID => category option keys, none meaning the whole theme.

Return an empty array to skip the subscribe. A per-form variant runs after it: wk_gf_subscribethemes{form_id}. For example ['theme-1' => [], 'theme-2' => ['category-3', 'category-4']] subscribes to the whole of theme-1 and to two categories of theme-2.

ParameterTypeDescription
$themesarray<string,string[]>
$entryarray
$formarray
$feedarray|null

wk_gf_subscribe_themes_{$form_id}

The themes to subscribe to for one form, e.g. wk_gf_subscribe_themes_3 for form 3. Runs after wk_gf_subscribe_themes.

ParameterTypeDescription
$themesarray<string,string[]>
$entryarray
$formarray
$feedarray|null

wk_gf_subscriber_pre_subscribe

The subscriber fields sent to POST /v1/subscribe (email, first_name, middle_name, last_name, company, ...).

Return false to skip the subscribe. A per-form variant runs after it: wk_gf_subscriber_presubscribe{form_id}.

ParameterTypeDescription
$subscriberarray<string,string>|false
$themesarray<string,string[]>
$entryarray
$formarray
$feedarray|null

wk_gf_subscriber_pre_subscribe_{$form_id}

The subscriber fields for one form, e.g. wk_gf_subscriber_pre_subscribe_3 for form 3. Runs after wk_gf_subscriber_pre_subscribe.

ParameterTypeDescription
$subscriberarray<string,string>|false
$themesarray<string,string[]>
$entryarray
$formarray
$feedarray|null

These Gravity Forms filters change how the add-on’s feeds run. See Sending in the background.

Filter Default Use
gform_is_feed_asynchronous true for this add-on Return false to send feeds during the submit. The add-on’s slug is wereldkundig.
gform_max_async_feed_attempts 1 Raise it to retry failed background feeds.
Action Use
wk_gf_refresh_fields The WP-Cron event of the background refresh. Run it by hand with wp cron event run wk_gf_refresh_fields.

Add a company to every subscriber of form 3, and never subscribe test addresses:

add_filter('wk_gf_subscriber_pre_subscribe_3', function ($subscriber) {
$subscriber['company'] = 'Gemeente Voorbeeld';
return $subscriber;
});
add_filter('wk_gf_subscriber_pre_subscribe', function ($subscriber) {
if (str_ends_with($subscriber['email'] ?? '', '@example.com')) {
return false;
}
return $subscriber;
});

Also subscribe everyone who checks a box on form 5 to the whole theme theme-1:

add_filter('wk_gf_subscribe_themes_5', function ($themes) {
$themes['theme-1'] = [];
return $themes;
});

The theme filters only run when at least one checked field has a valid theme. Themes you add in a filter aren’t checked against the platform’s themes, so use IDs that exist.

Give the platform more time to answer:

add_filter('wk_api_timeout', function () {
return 20;
});