### [wpforms_display_field_before](https://wpforms.com/developers/wpforms_display_field_before/)

**Published:** February 24, 2021
**Author:** Editorial Team

**Excerpt:** The wpforms_display_field_before action fires before the form are displayed to determine the position of certain form elements such as labels.

**Content:**

## Description

The `wpforms_display_field_before` action fires before the form are displayed to determine the position of certain form elements such as labels.

## Parameters

$fields(*array*) Sanitized entry field values/properties.$form\_data(*array*) Form settings/data.## Source

`wpforms/src/Frontend/Frontend.php`

## More Information

The action fires before the form is displayed. This action can be used to move attributes of the form around such as form field labels.

## Examples

In this example, we’re going to remove the labels completely by removing the action.

```

/**
 * Action fires before the form is displayed to determine the position of certain form elements such as labels.
 *
 * @link   https://wpforms.com/developers/wpforms_display_field_before/
 * 
 * @param  array    $fields      Sanitized entry field values/properties.
 * @param  array    $form_data   Form settings/data.
 * @return array
 */

function wpf_dev_display_field_before( $field, $form_data ) {
  
    // Only run this snippet on the form with the ID of 879
    if ( absint( $form_data[ 'id' ] ) !== 879 ) {
        return;
    }
 
    remove_action( 'wpforms_display_field_before', array( wpforms()->frontend, 'field_label' ), 15, 2 );
}
add_action( 'wpforms_display_field_before', 'wpf_dev_display_field_before', 10, 2 );

```

## Reference Articles

- [How to Add Material Design to Your Form Fields Using CSS](https://wpforms.com/developers/how-to-add-material-design-to-your-form-fields-using-css/ "How to Add Material Design to Your Form Fields Using CSS")
- [How to Create a Form With Floating Labels](https://wpforms.com/developers/how-to-create-a-form-with-floating-labels/ "How to Create a Form With Floating Labels")
- [How to Display Shortcodes Inside the Label of the Form Field](https://wpforms.com/developers/how-to-display-shortcodes-inside-the-label-of-the-form-field/ "How to Display Shortcodes Inside the Label of the Form Field")

**Categories:** Actions Hooks

**Tags:** PHP

---

