# Theme Button Classes on WPForms Submit Buttons

> Adds your theme's button classes to every WPForms submit button, so forms match the other buttons on your site without extra CSS.

- Type: PHP
- Runs: Run everywhere
- Category: [Forms](https://wpide.com/library/category/forms/)
- Tags: wpforms, buttons, styling
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/wpforms-submit-button-classes/

## Code

```php
$wpide_wpf_button_classes = 'wp-element-button';

add_filter( 'wpforms_frontend_form_data', function ( $form_data ) use ( $wpide_wpf_button_classes ) {
    if ( ! isset( $form_data['settings'] ) || ! is_array( $form_data['settings'] ) ) {
        return $form_data;
    }

    $current = isset( $form_data['settings']['submit_class'] ) ? (string) $form_data['settings']['submit_class'] : '';
    $form_data['settings']['submit_class'] = trim( $current . ' ' . $wpide_wpf_button_classes );

    return $form_data;
} );
```

## Notes

Set the classes your theme uses, such as wp-element-button for block themes or btn btn-primary for Bootstrap themes.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Theme Button Classes on WPForms Submit Buttons" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
