Whether current user has a specific capability.
While checking against particular roles in place of a capability is supported in part, this practice is discouraged as it may produce unreliable results.
<?php current_user_can( $capability , $object_id ); ?>
For additional information on the 'undefined index 0' warning please see this detailed response on the WordPress Stack Exchange.
current_user_can( $capability ) will aways return true if user is Super Admin, unless specifically denied - see inline source code on https://developer.wordpress.org/reference/classes/wp_user/has_cap/
Passing role names to current_user_can() is discouraged as this is not guaranteed to work correctly (see #22624).
current_user_can() is located in