wp_readonly()WP 5.9.0

Outputs the HTML readonly attribute.

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

No Hooks.

Return

String. HTML attribute or empty string.

Usage

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

Changelog

Since 5.9.0 Introduced.

Code of wp_readonly() WP 6.0

function wp_readonly( $readonly, $current = true, $echo = true ) {
	return __checked_selected_helper( $readonly, $current, $echo, 'readonly' );
}