// 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
/** * 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
function wpcode_snippet_remove_query_strings_split( $src ) { $output = preg_split( “/(&ver|\?ver)/”, $src ); return $output ? $output[0] : ”; } add_action( ‘init’, function () { if ( ! is_admin() ) { add_filter( ‘script_loader_src’, ‘wpcode_snippet_remove_query_strings_split’, 15 ); add_filter( ‘style_loader_src’, ‘wpcode_snippet_remove_query_strings_split’, 15 ); }…Continue reading
/** * 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
/** * 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
/** * 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
/** * Disable the space key with the special CSS class * Apply the class “wpf-disable-space” to the field to enable. * * @link https://wpforms.com/developers/how-to-disable-the-space-key-inside-a-form-field/ * */ function wpf_dev_disalbe_space() { ?>Continue reading
/** * Output something before your form(s). * * @link https://wpforms.com/developers/how-to-add-a-video-before-your-form/ */ function wpf_dev_frontend_output_before( $form_data, $form ) { // Optional, you can limit to specific forms. Below, we restrict output to // form #999. if ( absint( $form_data[ ‘id’ ]…Continue reading
/** * Process Smart Tags inside HTML / Code Block form fields. * * @link https://wpforms.com/developers/how-to-process-smart-tags-in-html-fields/ */ function wpf_dev_html_process_smarttags( $properties, $field, $form_data ) { $properties[ ‘inputs’ ][ ‘primary’ ][ ‘code’ ] = apply_filters( ‘wpforms_process_smart_tags’, $properties[ ‘inputs’ ][ ‘primary’ ][ ‘code’…Continue reading
/** * Using Smart Tags in WordPress rewrite rules * * @link https://wpforms.com/developers/how-to-use-smart-tags-in-your-wordpress-rewrite-rules/ */ // Register custom query var function register_query_var( $wp ) { parse_str( $wp->matched_query, $url ); if ( ! isset( $url[ ’email_address’ ] ) ) { return; }…Continue reading