Home › Forums › General Issues › get_field('field', $page_id) not returning a value. › Reply To: get_field('field', $page_id) not returning a value.
I can display the custom field on the page with the ACF option for my text element.
-> this will display 15, hence my conclusion that the field has the correct value.
But I can’t use that ACF option of the text element to put that value as a parameter on the shortcode.=> As in I can’t print/echo the id into the actual shortcode, if this would be the shortcode [shortcode id=”?”], then I can’t get the ACF value on the ? as I can only get that with the text element (which is a shortcode itself).
So I need to get the field via the page id within the shordcode code.
var_dump gives me: NULL
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.