Blocks

Block Show Rules

Block show rules control where a block appears in the Gutenberg inserter.

Show On A Post Type#

Use show.post_types for whole WordPress post types:

phpresources/views/blocks/article-banner.php
title: Article Bannercategory: Sectionsshow:  post_types: post---<section>  <h2>Article banner</h2></section>

This block appears while editing posts.

Use page for pages, or the slug of a custom post type:

php
show:  post_types: post, page, project

Show On Specific Pages#

Use show.pages for individual pages:

php
show:  pages: contact

You can use page slugs, page IDs, front_page, and posts_page:

php
show:  pages:    - contact    - 42    - front_page

Combine Rules#

When post_types and pages are both present, either match can show the block:

php
show:  post_types: post  pages: contact

show only controls editor availability. Blocks already saved in content can still render on the frontend.