acf/shortcode/prevent_access_to_fields_on_non_public_posts
acf/shortcode/prevent_access_to_fields_on_non_public_posts
Appears in: advanced-custom-fields.6.3.5
Hook Type: filter
Displaying hooks found in version: advanced-custom-fields.6.3.5apply_filters('acf/shortcode/prevent_access_to_fields_on_non_public_posts') is found 1 times:
- /includes/api/api-template.php line 105210481049105010511052105310541055105610571058
$decoded_post_id
= acf_decode_post_id(
$post_id
);
// If we've decoded to a post, ensure the post is publicly visible.
if
(
$decoded_post_id
[
'type'
] ===
'post'
) {
if
(
$atts
[
'post_id'
] !== false && ( (int)
$atts
[
'post_id'
] !== (int) acf_get_valid_post_id() ) && ( ! is_post_publicly_viewable(
$decoded_post_id
[
'id'
] ) ) && apply_filters(
'acf/shortcode/prevent_access_to_fields_on_non_public_posts'
, true ) ) {
if
( is_preview() ) {
return
apply_filters(
'acf/shortcode/post_not_public_message'
, __(
'[The ACF shortcode cannot display fields from non-public posts]'
,
'acf'
) );
}
else
{
return
;
}
}