apply_filters( 'riff_post_blocks', bool $on, WP_Post $post )

Filters whether a post's blocks are served as a tree at riff/v1/posts/{id}/blocks to someone who cannot edit the post.

Parameters

$onbool
Whether to serve them. Default false.
$postWP_Post
The post asked for.

More Information

The tree is the post's own markup, before any block renders, so a plugin that hides part of a post as it renders, a members-only block, say, is not asked. Turn it on where nothing on the site does that. Someone who may edit the post always gets its blocks, as they get its raw content from wp/v2, and a post that is not published, or is behind a password, is never served to anyone else.

Usage

add_filter( 'riff_post_blocks', function ( $on, $post ) {
	return $on;
}, 10, 2 );

Source

if ( ! apply_filters( 'riff_post_blocks', false, $post ) ) {

Changelog

VersionDescription
6.5.0Introduced.