Codex

Function Reference/disabled

Contents

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.

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

Returns

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

Usage

<input type="radio" name="attachments"  value="<?php echo $value; ?>" <?php disabled( $value, false ); ?> />

Changelog

Since: 3.0

Source File

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

Related

selected(), checked()