Make WordPress Core


Ignore:
Timestamp:
12/14/2018 12:54:51 AM (7 years ago)
Author:
pento
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.

Merges [43770] from the 5.0 branch to trunk.

Props danielbachhuber, birgire.
Fixes #43887.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-includes/blocks.php

    r44118 r44127  
    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.