acf/fields/relational/hide_unreadable_posts

Last updated Nov 2, 2026

Overview

Control whether Relationship, Post Object, and Page Link values leave out posts that can’t be read.

Description

When an ACF Block renders, ACF leaves out any posts in its Relationship, Post Object, and Page Link values that can’t be read, such as another user’s unpublished drafts. This includes values returned by get_field() in a block template.

Block data is stored in the post content, so ACF checks it when the block renders:

  • On the front end, a block saved in a post or synced pattern is checked against the author of that post or pattern. Posts that author could read show to every visitor.
  • Block previews in the editor, and previews of posts, are checked against the current user.
  • Blocks that aren’t saved in a post or synced pattern, such as in template parts and widgets, are checked against the current user in the admin, AJAX, and REST API requests, and aren’t checked on the front end.

Use this filter to turn the check off for blocks, or to apply it to other values too, such as get_field() in theme templates.

Parameters

apply_filters( 'acf/fields/relational/hide_unreadable_posts', $hide, $post_id, $field );

$hide (bool) Whether to leave out posts that can’t be read. Default: true for values formatted while an ACF Block renders, except blocks on the front end that aren’t saved in a post or synced pattern. Otherwise false.

$post_id (int|string) The ACF post ID the value is formatted for. For ACF Blocks, this starts with block_.

$field (array) The field array containing all settings.

Example

Turn off the check for ACF Blocks

add_filter( 'acf/fields/relational/hide_unreadable_posts', '__return_false' );

Leave out unreadable posts everywhere

add_filter( 'acf/fields/relational/hide_unreadable_posts', '__return_true' );

When this returns true outside a block, values are checked against the current user. Visitors who aren’t logged in can only read published posts and posts with a public status, of post types that are public or that the field lists.

Changelog

  • Added in version 6.8.11

Notes

  • If a block isn’t showing a related post to visitors, the referenced post usually isn’t published, or the block’s post author can’t read it.
  • To change who can read a post, use the acf/user_can_read_post filter.
Supercharge Your Website With Premium Features Using ACF PRO

Speed up your workflow and unlock features to better develop websites using ACF Blocks and Options Pages, with the Flexible Content, Repeater, Clone, Gallery Fields & More.

Explore Features View Pricing

PRO Features
ACF Blocks
Options Pages
PRO Fields
Repeater
Flexible Content
Gallery
Clone

Related