get_all_registered(); $allowed_block_types = array_keys($registered_blocks); } // Create a new array for the allowed blocks. $filtered_blocks = array(); // Loop through each block in the allowed blocks list. foreach ($allowed_block_types as $block) { // Check if the block is not in the disallowed blocks list. if (! in_array($block, $disallowed_blocks, true)) { // If it's not disallowed, add it to the filtered list. $filtered_blocks[] = $block; } } // Return the filtered list of allowed blocks return $filtered_blocks; } add_filter('allowed_block_types_all', 'carhop_blocks_disallow_block_types', 10, 2);