use_block_editor_for_post

The timeline below displays how wordpress function use_block_editor_for_post has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Returns whether the post can be edited in the block editor.
 *
 * @since 5.0.0
 * @since 6.1.0 Moved to wp-includes from wp-admin.
 *
 * @param int|WP_Post $post Post ID or WP_Post object.
 * @return bool Whether the post can be edited in the block editor.
 */
function use_block_editor_for_post($post)
{
    $post = get_post($post);
    if (!$post) {
        return false;
    }
    // We're in the meta box loader, so don't use the block editor.
    if (is_admin() && isset($_GET['meta-box-loader'])) {
        check_admin_referer('meta-box-loader', 'meta-box-loader-nonce');
        return false;
    }
    $use_block_editor = use_block_editor_for_post_type($post->post_type);
    /**
     * Filters whether a post is able to be edited in the block editor.
     *
     * @since 5.0.0
     *
     * @param bool    $use_block_editor Whether the post can be edited or not.
     * @param WP_Post $post             The post being checked.
     */
    return apply_filters('use_block_editor_for_post', $use_block_editor, $post);
}

WordPress Version: 5.9

/**
 * Returns whether the post can be edited in the block editor.
 *
 * @since 5.0.0
 *
 * @param int|WP_Post $post Post ID or WP_Post object.
 * @return bool Whether the post can be edited in the block editor.
 */
function use_block_editor_for_post($post)
{
    $post = get_post($post);
    if (!$post) {
        return false;
    }
    // We're in the meta box loader, so don't use the block editor.
    if (isset($_GET['meta-box-loader'])) {
        check_admin_referer('meta-box-loader', 'meta-box-loader-nonce');
        return false;
    }
    $use_block_editor = use_block_editor_for_post_type($post->post_type);
    /**
     * Filters whether a post is able to be edited in the block editor.
     *
     * @since 5.0.0
     *
     * @param bool    $use_block_editor Whether the post can be edited or not.
     * @param WP_Post $post             The post being checked.
     */
    return apply_filters('use_block_editor_for_post', $use_block_editor, $post);
}

WordPress Version: 5.8

/**
 * Return whether the post can be edited in the block editor.
 *
 * @since 5.0.0
 *
 * @param int|WP_Post $post Post ID or WP_Post object.
 * @return bool Whether the post can be edited in the block editor.
 */
function use_block_editor_for_post($post)
{
    $post = get_post($post);
    if (!$post) {
        return false;
    }
    // We're in the meta box loader, so don't use the block editor.
    if (isset($_GET['meta-box-loader'])) {
        check_admin_referer('meta-box-loader', 'meta-box-loader-nonce');
        return false;
    }
    $use_block_editor = use_block_editor_for_post_type($post->post_type);
    /**
     * Filters whether a post is able to be edited in the block editor.
     *
     * @since 5.0.0
     *
     * @param bool    $use_block_editor Whether the post can be edited or not.
     * @param WP_Post $post             The post being checked.
     */
    return apply_filters('use_block_editor_for_post', $use_block_editor, $post);
}

WordPress Version: 5.6

/**
 * Return whether the post can be edited in the block editor.
 *
 * @since 5.0.0
 *
 * @param int|WP_Post $post Post ID or WP_Post object.
 * @return bool Whether the post can be edited in the block editor.
 */
function use_block_editor_for_post($post)
{
    $post = get_post($post);
    if (!$post) {
        return false;
    }
    // We're in the meta box loader, so don't use the block editor.
    if (isset($_GET['meta-box-loader'])) {
        check_admin_referer('meta-box-loader', 'meta-box-loader-nonce');
        return false;
    }
    // The posts page can't be edited in the block editor.
    if (absint(get_option('page_for_posts')) === $post->ID && empty($post->post_content)) {
        return false;
    }
    $use_block_editor = use_block_editor_for_post_type($post->post_type);
    /**
     * Filters whether a post is able to be edited in the block editor.
     *
     * @since 5.0.0
     *
     * @param bool    $use_block_editor Whether the post can be edited or not.
     * @param WP_Post $post             The post being checked.
     */
    return apply_filters('use_block_editor_for_post', $use_block_editor, $post);
}

WordPress Version: 5.2

/**
 * Return whether the post can be edited in the block editor.
 *
 * @since 5.0.0
 *
 * @param int|WP_Post $post Post ID or WP_Post object.
 * @return bool Whether the post can be edited in the block editor.
 */
function use_block_editor_for_post($post)
{
    $post = get_post($post);
    if (!$post) {
        return false;
    }
    // We're in the meta box loader, so don't use the block editor.
    if (isset($_GET['meta-box-loader'])) {
        check_admin_referer('meta-box-loader', 'meta-box-loader-nonce');
        return false;
    }
    // The posts page can't be edited in the block editor.
    if (absint(get_option('page_for_posts')) === $post->ID && empty($post->post_content)) {
        return false;
    }
    $use_block_editor = use_block_editor_for_post_type($post->post_type);
    /**
     * Filter whether a post is able to be edited in the block editor.
     *
     * @since 5.0.0
     *
     * @param bool    $use_block_editor Whether the post can be edited or not.
     * @param WP_Post $post             The post being checked.
     */
    return apply_filters('use_block_editor_for_post', $use_block_editor, $post);
}

WordPress Version: 5.0

/**
 * Return whether the post can be edited in the block editor.
 *
 * @since 5.0.0
 *
 * @param int|WP_Post $post Post ID or WP_Post object.
 * @return bool Whether the post can be edited in the block editor.
 */
function use_block_editor_for_post($post)
{
    $post = get_post($post);
    if (!$post) {
        return false;
    }
    // We're in the meta box loader, so don't use the block editor.
    if (isset($_GET['meta-box-loader'])) {
        check_admin_referer('meta-box-loader');
        return false;
    }
    // The posts page can't be edited in the block editor.
    if (absint(get_option('page_for_posts')) === $post->ID && empty($post->post_content)) {
        return false;
    }
    $use_block_editor = use_block_editor_for_post_type($post->post_type);
    /**
     * Filter whether a post is able to be edited in the block editor.
     *
     * @since 5.0.0
     *
     * @param bool    $use_block_editor Whether the post can be edited or not.
     * @param WP_Post $post             The post being checked.
     */
    return apply_filters('use_block_editor_for_post', $use_block_editor, $post);
}