Php 高级自定义字段:调用未定义函数get_field()

Php 高级自定义字段:调用未定义函数get_field(),php,mysql,advanced-custom-fields,acfpro,Php,Mysql,Advanced Custom Fields,Acfpro,如果我尝试在自定义函数插件中使用ACF,则会出现以下错误: Uncaught Error: Call to undefined function get_field() in 我创建了我的自定义函数插件,以避免使用该主题附带的default functions.php,因为它会覆盖每次更新 我的代码: <?php $author_id = get_the_author_meta('ID'); $author_badge = get_field('post_autor', 'user_'

如果我尝试在自定义函数插件中使用ACF,则会出现以下错误:

Uncaught Error: Call to undefined function get_field() in
我创建了我的自定义函数插件,以避免使用该主题附带的default functions.php,因为它会覆盖每次更新

我的代码:

<?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']; ?>" />

第二次更新:
仍然有同样的问题。

我是通过wp admin安装的,如果这是问题的话,正常程序。我刚刚卸载并重新安装了插件,但这次我从wordpress插件目录下载的文件中手动上传了它。还是同样的问题。你不知道它可能是什么吗?真是巧合,这真是一个小世界。我也知道如何使用谷歌,但不幸的是,我无法用这种方式解决我的问题(我已经报告了,已经2天了,我没有得到回复。
调用未定义函数get_field()
意味着它无法识别导致错误配置/禁用插件的函数。
// Define path and URL to the ACF plugin.
define( 'MY_ACF_PATH', get_stylesheet_directory() . '/includes/acf/' );
define( 'MY_ACF_URL', get_stylesheet_directory_uri() . '/includes/acf/' );

// Include the ACF plugin.
include_once( MY_ACF_PATH . 'acf.php' );

// Customize the url setting to fix incorrect asset URLs.
add_filter('acf/settings/url', 'my_acf_settings_url');
function my_acf_settings_url( $url ) {
    return MY_ACF_URL;
}

// (Optional) Hide the ACF admin menu item.
add_filter('acf/settings/show_admin', 'my_acf_settings_show_admin');
function my_acf_settings_show_admin( $show_admin ) {
    return false;
}