Skip to content

Instantly share code, notes, and snippets.

@evanfraser
Last active July 13, 2022 17:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanfraser/8f09c7318176589c200780f29dacd332 to your computer and use it in GitHub Desktop.
Save evanfraser/8f09c7318176589c200780f29dacd332 to your computer and use it in GitHub Desktop.
Change Gravity Forms submit input to a button element
<?php
function form_submit_button ($button, $form) {
$button = str_replace("input", "button", $button);
$button = str_replace("/", "", $button);
$button .= "{$form['button']['text']}</button>";
return $button;
}
add_filter('gform_submit_button', 'form_submit_button', 10, 5);
// It's not perfect - it leaves some inapplicable attributes in the element
// It leaves the important onclick and tab index intact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment