If I try to use ACF inside my custom functions plugin, I get this error:
Uncaught Error: Call to undefined function get_field() in
On the other hand, if I try to use it inside my theme’s function.php file, I a theme error:
Whoops \ Exception \ ErrorException (E_NOTICE)
Trying to access array offset on value of type null
My code:
<?php
$author_id = get_the_author_meta('ID');
$author_badge = get_field('post_autor', 'user_'. $author_id );
?>
<img src="<?php echo $author_badge['url']; ?>" alt="<?php echo $author_badge['alt']; ?>" />
Using a Gantry5 theme.
I already followed the documentation and read some posts with examples, but even so I’m not being able to get it to work.
The field is set as User Object.