acf/shortcode/prevent_access_to_fields_on_non_public_posts

acf/shortcode/prevent_access_to_fields_on_non_public_posts

Hook Type: filter

See hook in core

Displaying hooks found in version: advanced-custom-fields.6.3.5

apply_filters('acf/shortcode/prevent_access_to_fields_on_non_public_posts') is found 1 times:

  • /includes/api/api-template.php line 1052
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    $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;
            }
        }