Grab an ACF field value from any post, using the post's ID

//  Use [featured id='#my post ID' my_field='#the ACF field name I want']
function gg_get_field($attr){
    $args = shortcode_atts( array(
          'id' => '1',
          'my_field' => 'featured'
    ), $attr );
    return get_field($args['my_field'], $args['id']);
}
add_shortcode( 'featured' , 'gg_get_field' );
1 Like

Hi, this is a great snippet.
However if any shortcode exists in the target ACF field, the data from the “target my post ID” referenced by that shortcode, will not be processed correctly. It will execute the shortcode using the field values from the location were the “featured” shortcode was entered. Hence an erroneous result.