ACF fields not working for current page,
ie. get_field(‘title’, id);
When i pass post id dynamic in this function, that time its not working but if i just pass static post id that time its not working on current page only, others pages showing that value.
can anyone help me out of this ?
Thanks in advance..
If you’re trying to get a field for the current page you shouldn’t need to set the ID parameter.
You can just say:
get_field('title');
But if you wanted to pass the ID for some reason you could do:
get_field('title', get_the_ID());
If you’re on another page you will need to pass the ID for the page/post you’re trying to get the data from.