On this page
block_version( string $content ): int
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.
Parameters
$contentstring Required-
Content to test.
Return
int The block format version is 1 if the content contains one or more blocks, 0 otherwise.
Source
File: wp-includes/blocks.php. View all references
function block_version( $content ) {
return has_blocks( $content ) ? 1 : 0;
}
Related
Uses
| Uses | Description |
|---|---|
| has_blocks() wp-includes/blocks.php | Determines whether a post or content string has blocks. |
Used By
| Used By | Description |
|---|---|
| WP_REST_Templates_Controller::prepare_item_for_response() wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Prepare a single template output for response |
| WP_REST_Posts_Controller::prepare_item_for_response() wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares a single post output for response. |
Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/block_version