Do not output empty name and id HTML attributes in get_submit_button().

Props afercia. Fixes #31749.

git-svn-id: https://develop.svn.wordpress.org/trunk@31880 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-03-25 03:22:18 +00:00
parent 87e372299d
commit 9ef45a7200
1 changed files with 5 additions and 1 deletions

View File

@ -1908,7 +1908,11 @@ function get_submit_button( $text = '', $type = 'primary large', $name = 'submit
$attributes = $other_attributes;
}
$button = '<input type="submit" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class );
// Don't output empty name and id attributes.
$name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : '';
$id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class );
$button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
if ( $wrap ) {