Test for blocks within reusable blocks
WordPress has a handy function called has_block() that tests whether your page or post uses a particular block type.
WordPress has a handy function called has_block() that tests whether your page or post uses a particular block type.
When building custom blocks for the WordPress editor, sometimes we want to make them only available on specific post types.
The WordPress block editor supports a link picker that we can add to our custom blocks. The best bit is we can restrict its searches to a post type of our choosing.