Reputation: 23
I'm trying to do the OPPOSITE of this...
function my_custom_init() {
if (current_user_can('administrator')) {
remove_post_type_support( 'company', 'editor' );
remove_post_type_support( 'company', 'excerpt' );
}
}
add_action( 'init', 'my_custom_init' );
AKA: If current user is NOT 'administrator' then remove the post support.
Upvotes: 0
Views: 956
Reputation: 44833
Just negate the condition with !
:
function my_custom_init() {
if (!current_user_can('administrator')) {
remove_post_type_support( 'company', 'editor' );
remove_post_type_support( 'company', 'excerpt' );
}
}
add_action( 'init', 'my_custom_init' );
Upvotes: 2
Reputation: 2416
Try this using the not operator (!) as in:
function my_custom_init() {
if (!current_user_can('administrator') {
remove_post_type_support( 'company', 'editor' );
remove_post_type_support( 'company', 'excerpt' );
}
}
add_action( 'init', 'my_custom_init' );
Upvotes: 0