We have built a number of custom blocks with ACF, and they are working exactly as expected when added to post content. However when we add them to a widget area, get_field()
always returns null
on the front-end – though in the widget editor everything looks fine.
For example we have a “Recent Posts” block which (amongst other things) allows the user to select which post type(s) they want to query:
$post_type = get_field('post_type');
I’ve gone over the documentation multiple times and can’t see that we should need to do anything special here?
Has anyone else run into the same problem?