WordPress.org

Codex

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

Function Reference/disabled

Description

Compares two given values (for example, a saved option vs. one chosen in a form) and, if the values are the same, adds the disabled attribute to a form input field.

Usage

<input type="radio" name="attachments" value="<?php echo esc_attr$value ); ?>
<?php echo disabled$value1$value2false ); ?> />

Parameters

$disabled
(mixed) (required) One of the values to compare.
Default: None
$current
(mixed) (optional) The other value to compare if not just true.
Default: true
$echo
(boolean) (optional) Whether to echo or just return the string. This function will always return the result regardless.
Default: true

Return Value

(string) 
HTML attribute (disabled='disabled') or empty string.

Changelog

Since: 3.0

Source File

disabled() is located in wp-includes/general-template.php.

Related

selected(), checked()