/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/e2e-tests/plugins/allowed-patterns-disable-blocks.php
24 строки
884 B
Dávid Szabó
Check for allowed blocks recursively in patterns (#30366)
14 май 2021, 16:07
Не верифицирован
14 май 2021, 16:07
6a843df
Код
Авторство
О чём код?
<?php /** * Plugin Name: Gutenberg Test Allowed Patterns Disable Blocks * Plugin URI: https://github.com/WordPress/gutenberg * Author: Gutenberg Team * * @package gutenberg-test-allowed-patterns-disable-blocks */ /** * Restrict the allowed blocks in the editor. * * @param Array $allowed_block_types An array of strings containing the previously allowed blocks. * @param WP_Post $post The current post object. * @return Array An array of strings containing the new allowed blocks after the filter is applied. */ function my_plugin_allowed_block_types( $allowed_block_types, $post ) { if ( 'post' !== $post->post_type ) { return $allowed_block_types; } return array( 'core/heading', 'core/columns', 'core/column', 'core/image', 'core/spacer' ); } add_filter( 'allowed_block_types', 'my_plugin_allowed_block_types', 10, 2 );