WordPress at a glance

readonly() WP 1.0

Outputs the html readonly attribute.

Compares the first two arguments and if identical marks as readonly

No Hooks.


String. HTML attribute or empty string


readonly( $readonly, $current, $echo );
$readonly(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 4.9.0 Introduced.

Code of readonly() WP 5.6

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

From tag: form functions

No comments
    Log In