Glossary Term
has_block()
has_block() — Determines whether a $post or a string contains a specific block type. This test optimizes for performance rather than strict accuracy, detecting whether the block type exists but not validating its structure and not checking synced patterns (formerly called reusable blocks). For strict accuracy, you should use the block parser on post content.
Inputs: $block_name (string): Full block type to look for. $post (int|string|WP_Post|null): Optional. Post content, post ID, or post object. Defaults to global $post.
Returns bool: Whether the post content contains the specified block.
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
