How to Automatically Redirect If User Is Already Logged In

/** * Automatic redirect from login form if a user is already logged in * * @link https://wpforms.com/developers/how-to-automatically-redirect-if-user-is-already-logged-in/ */ function redirect_to_specific_page() { // enter the page ID of the page that contains the login form $page_id = 345; // Change…Continue reading

How to Add an Input Mask to the International Postal Code

/* * Custom input mask for the address field’s international scheme. * * @link https://wpforms.com/developers/how-to-add-an-input-mask-to-the-international-postal-code */ function wpf_dev_address_field_properties( $properties, $field, $form_data ) { if($field[ ‘scheme’ ] === ‘international’) { $properties[ ‘inputs’ ][ ‘postal’ ][ ‘class’ ][] = ‘wpforms-masked-input’; $properties[ ‘inputs’…Continue reading

How to Disable Browser Autocomplete for Form Fields – all fields

/** * Disable form autocomplete for all fields on a specific form * * @link https://wpforms.com/developers/disable-browser-autocomplete-for-form-fields/ */ function wpf_dev_disable_form_autocomplete( $form_atts, $form_data ) { // This check will only form autocomplete for Form #11. // Removing this check would disable autocomplete…Continue reading

How to Customize the Labels for Image Choices – Combined effect

form#wpforms-form-1000 .wpforms-field .wpforms-image-choices-item:hover .wpforms-image-choices-label { position: absolute; top: 0; left: 50%; transform: translateX(-50%); background-color: #f6f6f6; color: #333; padding: 20%; border-radius: 5px; opacity: 1; transition: opacity 0.3s ease-in-out; width: 100%; height: 100%; } form#wpforms-form-1000 .wpforms-image-choices label:hover { border: none; box-shadow: none;…Continue reading

How to Customize the Labels for Image Choices

/* Position labels over images and hide them by default */ form#wpforms-form-1000 .wpforms-field .wpforms-image-choices-label { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(255, 255, 255, 0.7); text-align: center; display: flex; justify-content: center; align-items: center; opacity: 0;…Continue reading

How to Perform Field Comparisons Within Your WPForms

/** * Perform Field Comparisons * * @link https://wpforms.com/developers/how-to-perform-field-comparisons-within-your-wpforms/ */ function wpf_dev_compare_fields( $fields, $entry, $form_data ) { // Only run this snippet on the form ID 1000 if ( absint( $form_data[ ‘id’ ] ) !== 1000 ) { return $fields;…Continue reading