Determines whether a post or content string has blocks.
Description
This test optimizes for performance rather than strict accuracy, detecting the pattern of a block but not validating its structure. For strict accuracy, you should use the block parser on post content.
Parameters
$postint|string|WP_Post|nulloptional
Post content, post ID, or post object. Defaults to global $post.Default: null
Return
bool
Whether the post has blocks.
Uses · 2
get_post()Retrieves post data given a post ID or post object.
str_contains()Polyfill for `str_contains()` function added in PHP 8.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/blocks.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.