block_version() WordPress Function

The block_version() function allows you to get the current version number of the installed WordPress block editor. This can be useful for checking if a certain block editor feature is available, or for tracking down bugs.

block_version( string $content ) #

Returns the current version of the block format that the content string is using.


Description

If the string doesn’t contain blocks, it returns 0.


Top ↑

Parameters

$content

(string)(Required)Content to test.


Top ↑

Return

(int) The block format version is 1 if the content contains one or more blocks, 0 otherwise.


Top ↑

Source

File: wp-includes/blocks.php

function block_version( $content ) {
	return has_blocks( $content ) ? 1 : 0;
}


Top ↑

Changelog

Changelog
VersionDescription
5.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.