On this page
checked( mixed $checked, mixed $current = true, bool $echo = true ): string
Outputs the HTML checked attribute.
Description
Compares the first two arguments and if identical marks as checked.
Parameters
$checkedmixed Required-
One of the values to compare.
$currentmixed Optional-
The other value to compare if not just true.
Default:
true $echobool Optional-
Whether to echo or just return the string.
Default:
true
Return
string HTML attribute or empty string.
Source
File: wp-includes/general-template.php. View all references
function checked( $checked, $current = true, $echo = true ) {
return __checked_selected_helper( $checked, $current, $echo, 'checked' );
}
Related
Uses
| Uses | Description |
|---|---|
| __checked_selected_helper() wp-includes/general-template.php | Private helper function for checked, selected, disabled and readonly. |
Used By
| Used By | Description |
|---|---|
| WP_Screen::render_meta_boxes_preferences() wp-admin/includes/class-wp-screen.php | Renders the meta boxes preferences. |
| WP_Screen::render_list_table_columns_preferences() wp-admin/includes/class-wp-screen.php | Renders the list table columns preferences. |
| WP_Screen::render_view_mode() wp-admin/includes/class-wp-screen.php | Renders the list table view mode preferences. |
| signup_user() wp-signup.php | Shows a form for a visitor to sign up for a new user account. |
| 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. |
| use_ssl_preference() wp-admin/includes/user.php | Optional SSL preference that can be turned on by hooking to the ‘personal_options’ action. |
| WP_Screen::show_screen_options() wp-admin/includes/class-wp-screen.php | |
| WP_Screen::render_screen_layout() wp-admin/includes/class-wp-screen.php | Renders the option for number of columns on the page. |
| meta_box_prefs() wp-admin/includes/screen.php | Prints the meta box preferences for screen meta. |
| admin_color_scheme_picker() wp-admin/includes/misc.php | Displays the default admin color scheme picker (Used in user-edit.php). |
| Walker_Category_Checklist::start_el() wp-admin/includes/class-walker-category-checklist.php | Start the element output. |
| wp_media_insert_url_form() wp-admin/includes/media.php | Creates the form for external url. |
| post_comment_status_meta_box() wp-admin/includes/meta-boxes.php | Displays comments status form fields. |
| 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. |
| post_format_meta_box() wp-admin/includes/meta-boxes.php | Displays post format form elements. |
| Walker_Nav_Menu_Edit::start_el() wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. |
| 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. |
| Custom_Image_Header::step_1() wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| Custom_Image_Header::show_header_selector() wp-admin/includes/class-custom-image-header.php | Display UI for selecting one of several default headers. |
| Custom_Background::admin_page() wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| WP_Widget_Tag_Cloud::form() wp-includes/widgets/class-wp-widget-tag-cloud.php | Outputs the Tag Cloud widget settings form. |
| WP_Widget_Recent_Posts::form() wp-includes/widgets/class-wp-widget-recent-posts.php | Outputs the settings form for the Recent Posts widget. |
| WP_Widget_Categories::form() wp-includes/widgets/class-wp-widget-categories.php | Outputs the settings form for the Categories widget. |
| WP_Widget_Text::form() wp-includes/widgets/class-wp-widget-text.php | Outputs the Text widget settings form. |
| WP_Widget_Archives::form() wp-includes/widgets/class-wp-widget-archives.php | Outputs the settings form for the Archives widget. |
| WP_Widget_Links::form() wp-includes/widgets/class-wp-widget-links.php | Outputs the settings form for the Links widget. |
| wp_widget_rss_form() wp-includes/widgets.php | Display RSS widget options form. |
| WP_Customize_Control::render_content() wp-includes/class-wp-customize-control.php | Render the control’s content. |
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/checked