The Post ID condition is incredibly useful for Full Site Editing themes and reusable blocks. You can use Conditional Blocks to control the visibility of WordPress Block content based on the Post ID.
Full Site Editing lets people create their website layout using blocks. These blocks can appear in multiple places throughout the whole site. You might want to hide or show specific blocks from certain pages or posts.
TIP: It’s important to know that each page/post/custom post type in WordPress has a unique ID called the post ID.
Post IDs Conditon example
As an example, you may have created a reusable block to display email signup in the header of your website. The email signup is now displaying on your entire site, but you don’t want it to display on your dedicated “Newsletter Signup” page. There’s no need to have the signup form displayed twice, right?
You can use the Post IDs condition type on your email signup block and exclude it from appearing on the “Newsletter Signup” page.
Post ID Options
The selected block should be visible when the current page:
- Matches a list of Post IDs
- Doesn’t match a list of Post IDs
Each post/page or custom post type has a post ID. All post IDs are unique, so you can safely use this feature across your WordPress site.
How do I find the post ID of a page?
You can find the post ID in multiple places around WordPress. The easiest way is to go to into the editor for a post and check the URL. You can see the
post=1613, that’s the post ID of this documentation. Your ID will be unique.
TIP: Post IDs never change. It’s completely safe to alter the page and the URL. Conditional Blocks + Post IDs condition will continue to work as it should.