/** * Filters the next, previous and submit buttons. * Replaces the forms buttons with while maintaining attributes from original . * @param string $button Contains the tag to be filtered. * @param object $form Contains all the properties of the current form. * @return string The filtered submit button. */ add_filter( 'gform_next_button', 'input_to_button', 10, 2 ); add_filter( 'gform_previous_button', 'input_to_button', 10, 2 ); add_filter( 'gform_submit_button', 'input_to_button', 10, 2 ); function input_to_button( $button, $form ) { $dom = new DOMDocument(); $dom->loadHTML( $button ); $input = $dom->getElementsByTagName( 'input' )->item(0); $new_button = $dom->createElement( 'button' ); $button_span = $dom->createElement( 'span', $input->getAttribute( 'value' ) ); $new_button->appendChild( $button_span ); $input->removeAttribute( 'value' ); foreach( $input->attributes as $attribute ) { $new_button->setAttribute( $attribute->name, $attribute->value ); } $input->parentNode->replaceChild( $new_button, $input ); return $dom->saveHtml($new_button); }