Created
January 30, 2016 10:28
-
-
Save mariokerkhof/fe3649285554a3fde8c1 to your computer and use it in GitHub Desktop.
ACF Disable Editing Standard Fields for user role
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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