get_post_type_capabilities example

// If not set, default to false.         if ( null === $args['map_meta_cap'] ) {
            $args['map_meta_cap'] = false;
        }

        // If there's no specified edit link and no UI, remove the edit link.         if ( ! $args['show_ui'] && ! $has_edit_link ) {
            $args['_edit_link'] = '';
        }

        $this->cap = get_post_type_capabilities( (object) $args );
        unset( $args['capabilities'] );

        if ( is_array( $args['capability_type'] ) ) {
            $args['capability_type'] = $args['capability_type'][0];
        }

        if ( false !== $args['query_var'] ) {
            if ( true === $args['query_var'] ) {
                $args['query_var'] = $this->name;
            } else {
                $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] );
            }
Home | Imprint | This part of the site doesn't use cookies.