WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get submit button

Description

Returns a submit button, with provided text and appropriate class

Usage

<?php get_submit_button$text$type$name$wrap$other_attributes ); ?>

Parameters

$text
(string) (optional) The text of the button
Default: Save Changes
$type
(string|array) (optional) The type of button. Common values: primary, secondary, delete.
Default: primary large
Note: $type can be a single value, or a space separated list of values, or an array of values. The values determine the HTML classes of the button.
  • If $type is 'delete', the classes are 'button delete'.
  • Otherwise the first class is 'button', followed by any of these in order of appearance:
    • type value 'primary' makes class 'button-primary'
    • type value 'small' makes class 'button-small'
    • type value 'large' makes class 'button-large'
    • type value 'secondary' or 'button-secondary' is ignored (the 'button' class has the styling)
    • any other type value 'foo' makes the class 'foo'
For example, the default $type 'primary large' results in a button with HTML classes 'button button-primary button-large'.
$name
(string) (optional) The HTML name of the submit button. If no id attribute is given in $other_attributes below, $name will be used as the button's id.
Default: submit
$wrap
(boolean) (optional) True if the output button should be wrapped in a paragraph tag, false otherwise. Defaults to true
Default: true
$other_attributes
(array|string) (optional) Other attributes that should be output with the button. Defaults to no other attributes.
Default:

Notes

  • The related function submit_button() echos the button instead of returning it as a string. It has a different default $type, 'primary', resulting in the HTML classes 'button button-primary'.

Change Log

Since: 3.1

Source File

get_submit_button() is located in wp-admin/includes/template.php