WC_Blocks_Utils::has_block_in_page( int|WP_Post $page, string $block_name )

Check if a given page contains a particular block.


Description Description


Parameters Parameters

$page

(Required) Page post ID or post object.

$block_name

(Required) The name (id) of a block, e.g. woocommerce/cart.


Top ↑

Return Return

(bool) Boolean value if the page contains the block or not. Null in case the page does not exist.


Top ↑

Source Source

File: includes/blocks/class-wc-blocks-utils.php


			


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.