i thought i could manage it this way – but it does not work
:
function builder_set_debug(){
if(is_admin()){
return 'debug';
}
}
add_action('avia_builder_mode', 'builder_set_debug');
i want the additional info only for admin users – if even a redacteur is logged in – these extra fields should not be present.
Hey Guenter,
Thank you for the inquiry.
You may need to check for the user capability using the current_user_can function.
// https://developer.wordpress.org/reference/functions/current_user_can/
For admin, try to check if the user can install plugins or themes.
// https://wordpress.org/support/article/roles-and-capabilities/
Best regards,
Ismael
Thanks – That works:
$user = wp_get_current_user();
$allowed_roles = array( 'administrator' );
if ( array_intersect( $allowed_roles, $user->roles ) ) {
add_action('avia_builder_mode', 'builder_set_debug');
function builder_set_debug(){
return 'debug';
}
}