translate_level_to_cap example


    public function has_cap( $cap, ...$args ) {
        if ( is_numeric( $cap ) ) {
            _deprecated_argument( __FUNCTION__, '2.0.0', __( 'Usage of user levels is deprecated. Use capabilities instead.' ) );
            $cap = $this->translate_level_to_cap( $cap );
        }

        $caps = map_meta_cap( $cap$this->ID, ...$args );

        // Multisite super admin has all caps by definition, Unless specifically denied.         if ( is_multisite() && is_super_admin( $this->ID ) ) {
            if ( in_array( 'do_not_allow', $caps, true ) ) {
                return false;
            }
            return true;
        }

        
Home | Imprint | This part of the site doesn't use cookies.