Apologies for the delay in my reply!!!
If I understand correctly, sure. Here’s an example:
// Check if the current user can manage options (by default an admin only capability).
if ( current_user_can( 'manage_options' ) ) {
// Register the metabox and fields.
add_action(
'cn_metabox',
static function() {
$atts = array(
'title' => 'Metabox Name', // Change this to a name which applies to your project.
'id' => 'custom_one', // Change this so it is unique to you project.
'context' => 'normal',
'priority' => 'core',
'fields' => array(
array(
'name' => 'Field Name', // Change this field name to something which applies to you project.
'show_label' => TRUE, // Whether or not to display the 'name'. Changing it to false will suppress the name.
'id' => 'field_id', // Change this so it is unique to you project. Each field id MUST be unique.
'type' => 'text', // This is the field type being added.
'size' => 'regular', // This can be changed to one of the following: 'small', 'regular', 'large'
),
),
);
cnMetaboxAPI::add( $atts );
}
);
}
The custom text field metabox will only display for admin. This way only an admin can edit the field contents.
To display the field to the admin only, you would wrap the same user can check around the code that displays the field:
I hope this helps; please let me know.