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