Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_filter('render_block', 'custom_visibility_conditions_check', 11, 2);
- // Don't forget to specify block ID and the CPT slugs in $allowed_post_types
- function custom_visibility_conditions_check($block_content, $block){
- if(isset($block['attrs']['id']) && $block['attrs']['id'] == 'gsbp-xxxxxxx') {
- $allowed_post_types = array('books', 'movies');
- if(is_singular($allowed_post_types)){
- return $block_content;
- } else {
- return '';
- }
- }
- return $block_content;
- }
Advertisement
Add Comment
Please, Sign In to add comment