Hello,
I have an ACF field which is set to return a post object.
It does return the object as expected however I’m getting errors in my PHP log which say PHP “Warning: Attempt to read property “ID” on bool in (the theme template file) on the line with the code requesting the ID from the object.
The ID is actually returned despite the errors but they are really cluttering up my error log.
The code is very basic and looks like this:
$community = get_field(‘community’);
$community_id = $community->ID; <– The error is shown for this line of code.
The community field is a post object field with the Return Format set to “Post Object”.
How can I get rid of this annoying error?
Thanks,
Nicole