*/ public static function get_conditionals() { // This cannot have the Admin Conditional since it also needs to run in Rest requests. return [ Site_Kit_Conditional::class ]; } /** * Checks if the Site Kit capabilities need to be enabled for a manager. * * @param array $all_caps All the current capabilities of the current user. * @param array $cap_to_check The capability to check against. * * @return array */ public function enable_site_kit_capabilities( $all_caps, $cap_to_check ) { if ( ! isset( $cap_to_check[0] ) || ! \class_exists( Permissions::class ) ) { return $all_caps; } $user = \wp_get_current_user(); $caps_to_check = [ Permissions::SETUP, Permissions::VIEW_DASHBOARD, ]; if ( \in_array( $cap_to_check[0], $caps_to_check, true ) && \in_array( 'wpseo_manager', $user->roles, true ) ) { $all_caps[ $cap_to_check[0] ] = true; } return $all_caps; } }