Php post#U对象字段不';包括ACF之后,我再也不能工作了
在我将ACF包含到插件中之后,类型为“user”和“post_object”的字段就不再工作了。在我加入ACF之前,它们工作得非常好。它们已显示,但不再向我显示任何选项。你知道这可能是什么原因吗?我猜某些链接可能已更改,但我在代码中找不到任何提示:Php post#U对象字段不';包括ACF之后,我再也不能工作了,php,wordpress,advanced-custom-fields,Php,Wordpress,Advanced Custom Fields,在我将ACF包含到插件中之后,类型为“user”和“post_object”的字段就不再工作了。在我加入ACF之前,它们工作得非常好。它们已显示,但不再向我显示任何选项。你知道这可能是什么原因吗?我猜某些链接可能已更改,但我在代码中找不到任何提示: if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array( 'key' => 'group_5f65057cd8301',
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_5f65057cd8301',
'title' => 'Employees Details',
'fields' => array(
array(
'key' => 'field_5f8a0c6792e45',
'label' => 'Display Name',
'name' => 'display_name',
'type' => 'user',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'role' => array(
0 => 'employee',
1 => 'administrator',
),
'allow_null' => 0,
'multiple' => 0,
'return_format' => 'array',
),
array(
'key' => 'field_5f65089dbbe1d',
'label' => 'Occupation',
'name' => 'occupation',
'type' => 'post_object',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'post_type' => array(
0 => 'occupations',
),
'taxonomy' => '',
'allow_null' => 0,
'multiple' => 0,
'return_format' => 'object',
'ui' => 1,
),
array(
'key' => 'field_5f8b42ca6c4c6',
'label' => 'Costs per Hour',
'name' => 'costs_per_hour',
'type' => 'number',
'instructions' => 'Enter a number with max 2 decimals, separated by ".", e.g. "35.46"',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'min' => '',
'max' => '',
'step' => '0.01',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'employees',
),
),
),
'menu_order' => 0,
'position' => 'acf_after_title',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
));
endif;
与此同时,我发现:
控制台中存在以下错误:
加载资源失败:服务器响应…/advanced custom fields/assets/css/acf global.css?ver=5.9.1
ReferenceError:找不到变量:acf全局代码post-new.php 1972
(实际上我的post-new.php甚至没有那么多行)
当我单击最后一个调试器时,调试器会给出以下信息:
acf.data={“邮箱”:[{。。。
acf.doAction('prepare')
当我最后查看apache_error.log时,会出现如下错误:
文件不存在:/Applications/MAMP/htdocs/myPlugin/Applications,引用人:http://localhost:8888/myPlugin/wp-admin/post new.php?post_type=jobs这不是此函数的完整代码可能是问题所在?我添加了上述函数的其余部分。我不怀疑这与此相关。如果我将post_type更改为“posts”或“pages”,我仍然不知道找不到任何匹配项。在我看来,指向所选post_类型的链接不起作用。不幸的是,我不知道在哪里可以找到该链接。