【发布时间】:2020-08-23 16:14:07
【问题描述】:
如果我将帖子状态设置为“发布”(如下所示),此表单会创建帖子,但我的此帖子类型的 acf 字段(一些应该自动填充)不会添加到数据库中
如果我将 post-status 设置为“草稿”,此表单将创建草稿 - 如果我编辑并保存该草稿,一切都很好
有什么想法吗?
谢谢,理查德
<?php acf_form_head(); ?>
<?php get_header(); ?>
<div id="primary" class="rs-add-forms">
<div id="content" class="site-content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php acf_form(array(
'post_id' => 'new_post',
'post_title' => true,
'new_post' => array(
'post_type' => 'people',
'post_status' => 'publish'
),
'fields' => array('field_5ed5c2215be79',),
'submit_value' => 'Create Person',
'html_submit_button' => '<input type="submit" class="rs-add-button" value="%s" />',
'updated_message' => false
)); ?>
<?php endwhile; ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>
【问题讨论】:
标签: wordpress advanced-custom-fields custom-post-type