Storing User’s Uncached IP Address in Hidden Field

/** * Do not store the cached IP address in a hidden field * * @link https://wpforms.com/developers/how-to-store-the-non-cached-ip-address-into-a-hidden-field/ */ function wpf_hidden_ip_avoid_cache( $fields, $entry, $form_data ){ // Only run on the form with ID 727 if( $form_data[ ‘id’ ] == 727 )…Continue reading

Unattached Media Cleanup

// Schedule the event if it is not already scheduled function schedule_unattached_media_cleanup() { if (!wp_next_scheduled(‘delete_unattached_media_event’)) { wp_schedule_event(time(), ‘daily’, ‘delete_unattached_media_event’); } } add_action(‘wp’, ‘schedule_unattached_media_cleanup’); // Hook the function to the scheduled event add_action(‘delete_unattached_media_event’, ‘delete_unattached_media’); // Function to delete unattached media function…Continue reading

Sending Numerical Values Through Webhooks

/** * Send the numerical values through webhooks. * * @link https://wpforms.com/developers/how-to-send-the-numerical-values-through-webhooks/ */ function wpf_dev_webhooks_numeric_value( $filled_params, $params, $process ) { // Request Body params which values should be numeric. // List each variable that you want as a number and…Continue reading

Sending Geolocation Data Through Webhooks

/** * Send geolocation through webhooks. * * @link https://wpforms.com/developers/how-to-send-geolocation-through-webhooks */ function wpf_dev_geolocation_webhook( $options, $webhook_data, $fields, $form_data, $entry_id ) { // Optional, you can limit to specific forms. Below, we restrict output to // form #1899. if ( absint( $form_data[…Continue reading

How to Display Hidden Single Item Fields in Order Summary

/** * Display Hidden Single Item Fields in Order Summary * * @link https://wpforms.com/developers/how-to-display-hidden-single-item-fields-in-order-summary */ function wpf_include_singleitem_hiddentype_include_in_order_summary_footer($foot) { // replace the 1000 with your Form ID $form_data = wpforms()->form->get( 1000, [ ‘content_only’ => true ] ); // Replace with actual…Continue reading

Set a specific language for Cloudflare Turnstile.

/** * Set a specific language for Cloudflare Turnstile. * * @link https://wpforms.com/developers/how-to-set-the-language-for-cloudflare-turnstile */ function wpf_add_turnstile_language_script() { if (!wp_script_is(‘wpforms-recaptcha’, ‘enqueued’)) { return; } $language_code = ‘ar-eg’; // where ‘ar-eg’ is for Arabic (Egypt) language ?>Continue reading

Change the No Results Found text in Modern Dropdown

/** * Change the No Results Found text in Modern Dropdown. * * @link https://wpforms.com/developers/how-to-change-the-no-results-found-text-in-the-modern-dropdown-field/ */ function wpf_dev_change_modern_dropdown_noresults_text( $config, $forms ) { // Change 1369 to an ID of your actual form. if ( array_key_exists( 1369, $forms ) ) {…Continue reading