On this page
submit_button( string $text = null, string $type = 'primary', string $name = 'submit', bool $wrap = true, array|string $other_attributes = null )
Echoes a submit button, with provided text and appropriate class(es).
Description
See also
Parameters
$textstring Optional-
The text of the button (defaults to 'Save Changes')
Default:
null $typestring Optional-
The type and CSS class(es) of the button. Core values include
'primary','small', and'large'. Default'primary'.Default:
'primary' $namestring Optional-
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.
Default:
'submit' $wrapbool Optional-
True if the output button should be wrapped in a paragraph tag, false otherwise. Defaults to true.
Default:
true $other_attributesarray|string Optional-
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
More Information
This function cannot be used on the front end of the site, it is only available when loading the administration screens.
Parametr $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-secondary 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’ results in a button with HTML classes ‘button button-primary’.
This function does not return a value. The HTML for the button is output directly to the browser.
Uses the related function get_submit_button() , which returns the button as a string instead of echoing it. It has a different default $type, 'primary large', resulting in the HTML classes 'button button-primary button-large'.
Source
File: wp-admin/includes/template.php. View all references
function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
}
Related
Uses
| Uses | Description |
|---|---|
| get_submit_button() wp-admin/includes/template.php | Returns a submit button, with provided text and appropriate class. |
Used By
| Used By | Description |
|---|---|
| WP_MS_Sites_List_Table::extra_tablenav() wp-admin/includes/class-wp-ms-sites-list-table.php | Extra controls to be displayed between bulk actions and pagination. |
| wp_print_community_events_markup() wp-admin/includes/dashboard.php | Prints the markup for the Community Events section of the Events and News Dashboard widget. |
| WP_Plugins_List_Table::search_box() wp-admin/includes/class-wp-plugins-list-table.php | Displays the search box. |
| network_step1() wp-admin/includes/network.php | Prints step 1 for Network installation process. |
| display_setup_form() wp-admin/install.php | Displays installer setup form. |
| WP_Screen::render_screen_options() wp-admin/includes/class-wp-screen.php | Renders the screen options tab. |
| WP_Plugins_List_Table::extra_tablenav() wp-admin/includes/class-wp-plugins-list-table.php | |
| WP_Links_List_Table::extra_tablenav() wp-admin/includes/class-wp-links-list-table.php | |
| install_theme_search_form() wp-admin/includes/theme-install.php | Displays search form for searching themes. |
| install_themes_dashboard() wp-admin/includes/theme-install.php | Displays tags filter for themes. |
| install_themes_upload() wp-admin/includes/theme-install.php | Displays a form to upload themes from zip files. |
| WP_List_Table::search_box() wp-admin/includes/class-wp-list-table.php | Displays the search box. |
| WP_List_Table::bulk_actions() wp-admin/includes/class-wp-list-table.php | Displays the bulk actions dropdown. |
| install_search_form() wp-admin/includes/plugin-install.php | Displays a search form for searching plugins. |
| install_plugins_upload() wp-admin/includes/plugin-install.php | Displays a form to upload plugins from zip files. |
| _wp_dashboard_control_callback() wp-admin/includes/dashboard.php | Outputs controls for the current dashboard widget. |
| wp_network_dashboard_right_now() wp-admin/includes/dashboard.php | |
| wp_dashboard_quick_press() wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| find_posts_div() wp-admin/includes/template.php | Outputs the modal window used for attaching media to posts or pages in the media-listing screen. |
| meta_form() wp-admin/includes/template.php | Prints the form in the Custom Fields meta box. |
| wp_import_upload_form() wp-admin/includes/template.php | Outputs the form used by the importers to accept the data to be imported. |
| WP_Users_List_Table::extra_tablenav() wp-admin/includes/class-wp-users-list-table.php | Output the controls to allow user roles to be changed in bulk. |
| media_upload_type_form() wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| media_upload_gallery_form() wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| media_upload_library_form() wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| media_upload_form() wp-admin/includes/media.php | Outputs the legacy media upload form. |
| link_submit_meta_box() wp-admin/includes/meta-boxes.php | Displays link create form fields. |
| post_submit_meta_box() wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| attachment_submit_meta_box() wp-admin/includes/meta-boxes.php | Displays attachment submit form fields. |
| WP_Media_List_Table::extra_tablenav() wp-admin/includes/class-wp-media-list-table.php | |
| WP_Comments_List_Table::extra_tablenav() wp-admin/includes/class-wp-comments-list-table.php | |
| wp_nav_menu_item_post_type_meta_box() wp-admin/includes/nav-menu.php | Displays a meta box for a post type menu item. |
| wp_nav_menu_item_taxonomy_meta_box() wp-admin/includes/nav-menu.php | Displays a meta box for a taxonomy menu item. |
| request_filesystem_credentials() wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| WP_Posts_List_Table::inline_edit() wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| wp_widget_control() wp-admin/includes/widgets.php | Meta widget used to display the control form for a widget. |
| WP_Posts_List_Table::extra_tablenav() wp-admin/includes/class-wp-posts-list-table.php | |
| Custom_Image_Header::step_1() wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| Custom_Image_Header::step_2() wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. |
| confirm_delete_users() wp-admin/includes/ms.php | |
| list_core_update() wp-admin/update-core.php | Lists available core updates. |
| Custom_Background::admin_page() wp-admin/includes/class-custom-background.php | Displays the custom background page. |
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/submit_button