WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/19/2018 05:57:38 PM (22 months ago)
Author:
danielbachhuber
Message:

REST API: Include block_version on Post content object.

The block_version denotes which version of Blocks the post_content contains. Introduces new block_version() function for versioning Blocks.

Props danielbachhuber, birgire.
Fixes #43887.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/blocks.php

    r43752 r43770  
    263263    return $rendered_content;
    264264}
     265
     266/**
     267 * Returns the current version of the block format that the content string is using.
     268 *
     269 * If the string doesn't contain blocks, it returns 0.
     270 *
     271 * @since 5.0.0
     272 *
     273 * @param string $content Content to test.
     274 * @return int The block format version.
     275 */
     276function block_version( $content ) {
     277    return has_blocks( $content ) ? 1 : 0;
     278}
Note: See TracChangeset for help on using the changeset viewer.