Title: disabled
Published: April 25, 2014
Last modified: February 24, 2026

---

# disabled( mixed $disabled, mixed $current = true, bool $display = true ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#wp--skip-link--target)

Outputs the HTML disabled attribute.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#description)󠁿

Compares the first two arguments and if identical marks as disabled.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#parameters)󠁿

 `$disabled`mixedrequired

One of the values to compare.

`$current`mixedoptional

The other value to compare if not just true.

Default:`true`

`$display`booloptional

Whether to echo or just return the string.

Default:`true`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#return)󠁿

 string HTML attribute or empty string.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#source)󠁿

    ```php
    function disabled( $disabled, $current = true, $display = true ) {
    	return __checked_selected_helper( $disabled, $current, $display, 'disabled' );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/general-template.php#L5278)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/general-template.php#L5278-L5280)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#related)󠁿

| Uses | Description | 
| [__checked_selected_helper()](https://developer.wordpress.org/reference/functions/__checked_selected_helper/)`wp-includes/general-template.php` |

Private helper function for checked, selected, disabled and readonly.

  |

| Used by | Description | 
| [Walker_Category_Checklist::start_el()](https://developer.wordpress.org/reference/classes/walker_category_checklist/start_el/)`wp-admin/includes/class-walker-category-checklist.php` |

Start the element output.

  | 
| [wp_popular_terms_checklist()](https://developer.wordpress.org/reference/functions/wp_popular_terms_checklist/)`wp-admin/includes/template.php` |

Retrieves a list of the most popular terms from the specified taxonomy.

  | 
| [image_size_input_fields()](https://developer.wordpress.org/reference/functions/image_size_input_fields/)`wp-admin/includes/media.php` |

Retrieves HTML for the size radio buttons with the specified one checked.

  | 
| [post_tags_meta_box()](https://developer.wordpress.org/reference/functions/post_tags_meta_box/)`wp-admin/includes/meta-boxes.php` |

Displays post tags form fields.

  | 
| [wp_nav_menu_disabled_check()](https://developer.wordpress.org/reference/functions/wp_nav_menu_disabled_check/)`wp-admin/includes/nav-menu.php` |

Check whether to disable the Menu Locations meta box submit button and inputs.

  | 
| [request_filesystem_credentials()](https://developer.wordpress.org/reference/functions/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.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/disabled/?output_format=md#comment-content-1618)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/disabled/#comment-1618)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fdisabled%2F%23comment-1618)
    Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fdisabled%2F%23comment-1618)
 4. **Enable/disable text field according to the given value.**
 5.     ```php
        <?php $disable_text_field = true; ?>
        <input type="text" <?php disabled( $disable_text_field, true ); ?> name="sample_text_field" />
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fdisabled%2F%3Freplytocom%3D1618%23feedback-editor-1618)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fdisabled%2F)
before being able to contribute a note or feedback.