Skip to content

Instantly share code, notes, and snippets.

@proweb
Last active November 23, 2025 12:35
Show Gist options
  • Select an option

  • Save proweb/6f3ca2f27b0ba0afae5b8d28b3217003 to your computer and use it in GitHub Desktop.

Select an option

Save proweb/6f3ca2f27b0ba0afae5b8d28b3217003 to your computer and use it in GitHub Desktop.
Guenberg blocks snippets

Block snippets

Gutenberg curation in WordPress

Core Blocks Reference

Получить список цветов в консоли.

wp.data.select('core/block-editor').getSettings().colors;
<?php
// Allow only needed blocks in post types
function wpdocs_allowed_post_type_blocks( $allowed_block_types, $editor_context ) {
if ( 'sponsors' === $editor_context->post->post_type ) {
return array(
'core/paragraph',
);
}
if ( 'news' === $editor_context->post->post_type ) {
return array(
'core/paragraph',
'core/list',
'core/image',
'core/buttons',
'core/quote',
);
}
if ( 'faqs' === $editor_context->post->post_type ) {
return array(
'core/paragraph',
'core/list',
'core/image',
'core/buttons',
);
}
return $allowed_block_types;
}
add_filter( 'allowed_block_types_all', 'wpdocs_allowed_post_type_blocks', 10, 2 );
<?php
$block_types = WP_Block_Type_Registry::get_instance()->get_all_registered();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment