I’ve inherited a WP project that uses v2.0.5 of ACF. I’m attempting to bring it up to date. After updating the plugin I’ve started to get the following error…
Fatal error: Call to undefined function the_field_return()
Googling for it returns no results and this forum doesn’t seem to return any either. Anyone have any suggestions? I’m new to ACF so I’m starting from scratch…
Hi @uberspeck
the_field_return is not a function known to ACF.
Please use get_field instead.
Visit the docs to see all available functions.
Thanks
E
Hi Elliot, thanks for the quick response! I dug through the archive of the site (before I updated ACF) and I came across the method in api.php. Maybe the previous developer added it? Maybe if I add it to functions.php that will take care of it?
// the field return
function the_field_return($field_name, $post_id = false)
{
//echo 'field name: '.$field_name.', post id: '.$post_id;
$value = get_field($field_name, $post_id);
if(is_array($value))
{
$value = @implode(', ',$value);
}
return $value;
}
Hi @uberspeck
Yes, this looks like a custom function added to the plugin. I would move this to your theme functions.php file, or just use the standard get_field instead.
Thanks
E