I have ACF custom field in posts with the gallery ID. The custom field is stored in wp_postmeta table.
I am trying to execute shortcode on post page with the gallery id assigned to this post.
my code:
$post = get_post();
$gallery_id = the_field('gallery', $post->ID );
echo do_shortcode('[foogallery id="'. $gallery_id .'"]');
returns "The gallery was not found!"
echo($gallery_id); // returns 19557
echo do_shortcode('[foogallery id="19557"]'); // works well
How to execute the shortcode ont the post page with the ACF value for this post?
I was trying get_field() also but when echoing it returned: "Array to string conversion"