[ 'administrator', 'editor', 'author', 'contributor', 'shop_manager' ], self::EDIT_LOCAL_CSS_CLASS => [ 'administrator', 'editor', 'author', 'contributor', 'shop_manager' ], ]; foreach ( $capabilities as $cap => $roles ) { foreach ( $roles as $role_name ) { $role = get_role( $role_name ); if ( $role ) { $role->add_cap( $cap ); } } } } }