WordPress at Your Fingertips

checked() WP 1.0

Outputs the html checked attribute.

Compares the first two arguments and if identical marks as checked

1 time — 0.000001 sec (speed of light) | 50000 times — 0.01 sec (speed of light) | PHP 7.3.12, WP 5.3.2

No Hooks.


String. HTML attribute or empty string


checked( $checked, $current, $echo );
$checked(mixed) (required)
One of the values to compare
(true) The other value to compare if not just true
Default: true
Whether to echo or just return the string
Default: true


Since 1.0.0 Introduced.

Code of checked() WP 5.8.1

function checked( $checked, $current = true, $echo = true ) {
	return __checked_selected_helper( $checked, $current, $echo, 'checked' );

form functions

Supporting (helper utility auxiliary)

No comments
    Log In