_prepare_post_type example

if ( ! post_type_exists( $post_type_name ) ) {
            return new IXR_Error( 403, __( 'Invalid post type.' ) );
        }

        $post_type = get_post_type_object( $post_type_name );

        if ( ! current_user_can( $post_type->cap->edit_posts ) ) {
            return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
        }

        return $this->_prepare_post_type( $post_type$fields );
    }

    /** * Retrieves post types. * * @since 3.4.0 * * @see get_post_types() * * @param array $args { * Method arguments. Note: arguments must be ordered as documented. * * @type int $0 Blog ID (unused). * @type string $1 Username. * @type string $2 Password. * @type array $3 Optional. Query arguments. * @type array $4 Optional. Fields to fetch. * } * @return array|IXR_Error */
Home | Imprint | This part of the site doesn't use cookies.