Read only field except for admins
-
I know we can make some fields “Read Only”.
But is there a way to make them read only to all users except for admins?I manage to made some fields (checkbox_list and text-area) read only with the following code but i can´t make them editable by admins. Once they are Read Only they are Read only for all users including admins…
add_filter( ‘rwmb_my_field_1_html’, ‘prefix_input_readonly’ );
add_filter( ‘rwmb_my_field_2_html’, ‘prefix_input_readonly’ );
function prefix_input_readonly( $html )
{
return str_replace(
array(
‘<textarea’,
‘<input’,
),
array(
‘<textarea readonly’,
‘<input disabled’,
),
$html );
}Any help on this? Read only for all users but editable by admins?
Thank you
The topic ‘Read only field except for admins’ is closed to new replies.