Support › General › Show field in frontend but not allow to edit by the user
There exist a setting field (text field for example) that show the field in the frontend but don't allow editing by the user?
I have reviewed this page but I have not seen this option.
Yes, it can be done with a condition like this:
'type' => 'text',
'id' => 'field_id',
'name' => 'Text field',
'disabled' => ! is_admin(), // This disables editing in the front end.
ooh perfect!!! Many thanks.
I have a proble using:
'disabled' => !is_admin(), // This disables editing in the front end.
With a meta box with:
'storage_type' => 'custom_table', // Important
Is that all fields are saved well in the custom table except the fields that I put 'disabled' => !is_admin()...
Have you detected if it is a general error? Or does it just happen to me?
I try to put this like this
'attributes' => array(
'disabled' => true,
But it doesn't matter, not save the value...
I try this:
'readonly' => true,
and it run ok!! Users can't edit the field and the value is saved in the custom table.