Skip to content

Instantly share code, notes, and snippets.

@mariokerkhof
Created January 30, 2016 10:28
Show Gist options
  • Save mariokerkhof/fe3649285554a3fde8c1 to your computer and use it in GitHub Desktop.
Save mariokerkhof/fe3649285554a3fde8c1 to your computer and use it in GitHub Desktop.
ACF Disable Editing Standard Fields for user role
// Disable een standaard tekst veld(werkt niet op input en select fields)
function mkr_acf_disable_text_fields( $field ) {
$user_role = 'coordinator';
if( current_user_can( $user_role )) {
$field['disabled'] = 1;
} else {
$field['disabled'] = 0;
}
return $field;
}
add_action( 'acf/load_field/key=field_56a9c7a5274f6', 'mkr_acf_disable_text_fields', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment