为acf_form()添加分类术语

时间:2017-09-09 11:58:14

标签: wordpress advanced-custom-fields

我正在使用高级自定义字段中的acf_form()函数,以允许用户通过我的WordPress网站上的前端表单创建帖子。

我无法理解的是如何在创建时将自定义分类中的分类术语添加到这些帖子中。

这是我到目前为止的代码,它可以很好地创建帖子。

acf_form(array(
    'post_id'       => $submission_id,
    'post_title'    => true,
    'post_content'  => false,
    'new_post'      => array(
        'post_type'     => '2017-submission',
        'post_status'   => 'publish',
    ),
    'submit_value' => __("Save", 'acf'),
));

这里有类似于我期望的工作方式。第8和第9行组成。

acf_form(array(
    'post_id'       => $submission_id,
    'post_title'    => true,
    'post_content'  => false,
    'new_post'      => array(
        'post_type'     => '2017-submission',
        'post_status'   => 'publish', 
        'key' => 'project-category', // This is made up and does not work
        'value' => 'housing', // This is made up and does not work
    ),
    'submit_value' => __("Save", 'acf'),
));

0 个答案:

没有答案
相关问题