submit_button

Echoes a submit button, with provided text and appropriate class(es).

Description

submit_button( (constant) $text = null, (string) $type = 'primary', (string) $name = 'submit', (constant) $wrap = true, (null) $other_attributes = null ); 

Parameters (5)

0. $text — Optional. (constant) => null
The text of the button (defaults to Save Changes)
1. $type — Optional. (string) => 'primary'
The type and CSS class(es) of the button. Core values include primary,, secondary., delete. Default primary,
2. $name — Optional. (string) => 'submit'
The HTML name of the submit button. Defaults to submit.. If no id attribute is given in $other_attributes below, $name will be used as the button's id.
3. $wrap — Optional. (constant) => true
True if the output button should be wrapped in a paragraph tag, false otherwise. Defaults to true
4. $other_attributes — Optional. (null) => null
Other attributes that should be output with the button, mapping attributes to their values, such as setting tabindex to 1, etc. These key/value attribute pairs will be output as attribute="value", where attribute is the key. Other attributes can also be provided as a string such as tabindex=1"', though the array format is preferred. Default null.

Usage

  1. if ( !function_exists( 'submit_button' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/template.php'; 
  3.  
  4. // The text of the button (defaults to 'Save Changes') 
  5. $text = null; 
  6.  
  7. // Optional. The type and CSS class(es) of the button. Core values 
  8. // include 'primary', 'secondary', 'delete'. Default 'primary' 
  9. $type = 'primary'; 
  10. $name = 'submit'; 
  11.  
  12. // True if the output button should be wrapped in a paragraph tag, 
  13. // false otherwise. Defaults to true 
  14. $wrap = true; 
  15. $other_attributes = null; 
  16.  
  17. // NOTICE! Understand what this does before running. 
  18. $result = submit_button($text, $type, $name, $wrap, $other_attributes); 
  19.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/template.php  
  1. function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) { 
  2. echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );