Description

The wpforms_field_properties filter fires on form load to display the field properties such as labels, sublabels, and descriptions above the form field.

Parameters

$properties
(array) An array of field properties such as labels, sublabels and description.
$field
(array) Sanitized field data.
$form_data
(array) Processed form settings/data, prepared to be used later.

Source

wpforms/includes/fields/class-base.php

More Information

The filter is applied to an array for specific form field properties. Using this filter will change every form field.

Each form field will have its own unique filter name. See the section below for a complete list of documented examples. For example, if you only wanted to change the Email form field, you’d use wpforms_field_properties_email.

Examples

In the example below, the function will have the field Description displayed above the field itself but only for the form ID 225.

/**
 * Move the field description above the form field.
 *
 * @link   https://wpforms.com/developers/wpforms_field_properties/
 *
 * @param  array $properties Field properties.
 * @param  array $field      Field settings.
 * @param  array $form_data  Form data and settings.
 *
 * @return array
 */

function wpf_dev_field_properties( $properties, $field, $form_data ) {

    // Only process this snippet on the form ID 225
    if ( absint( $form_data[ 'id' ] ) !== 225 ) {

        return $properties;
    } 

    // move the field description from under the form field to above the form field
    $properties[ 'description' ][ 'position' ] = 'before';

    return $properties;

}
add_filter( 'wpforms_field_properties', 'wpf_dev_field_properties', 10, 3 );

Reference Articles