WordPress at a glance
function is not described

__checked_selected_helper() WP 2.8.0

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

Compares the first two arguments and if identical marks as $type

No Hooks.


String. HTML attribute or empty string


__checked_selected_helper( $helper, $current, $echo, $type ) // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore;
$helper(mixed) (required)
One of the values to compare
$current(mixed) (required)
(true) The other value to compare if not just true
$echo(true/false) (required)
Whether to echo or just return the string
$type(string) (required)
The type of checked|selected|disabled|readonly we are doing


Since 2.8.0 Introduced.

Code of __checked_selected_helper() WP 5.6

function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
	if ( (string) $helper === (string) $current ) {
		$result = " $type='$type'";
	} else {
		$result = '';

	if ( $echo ) {
		echo $result;

	return $result;