WC_Blocks_Utils::has_block_in_page
Determine if a page has a block in its content.
Method of the class: WC_Blocks_Utils{}
No Hooks.
Returns
bool. True if the page contains the block, false otherwise.
Usage
$result = WC_Blocks_Utils::has_block_in_page( $page, $block_name ): bool;
- $page(int|WP_Post) (required)
- Page post ID or post object.
- $block_name(string) (required)
- The name (id) of a block, e.g.
woocommerce/cart.
Notes
| See: has_block() |
WC_Blocks_Utils::has_block_in_page() WC Blocks Utils::has block in page code WC 11.0.1
public static function has_block_in_page( $page, $block_name ): bool {
return has_block( $block_name, $page );
}