最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Creating posts with acf_form() that has a relationship type field

programmeradmin0浏览0评论

I'm trying to design a form that creates a post, with the help of Advanced Custom Fields (ACF).

The post has a custom post type of 'movie' and has custom fields of type 'relationship' that link to other posts of type 'genre'.

I use this code for the form

<?php
acf_form_head();
?>


<?php
acf_form(array(
    'post_id' => 'new_post',
    'post_title' => true,
    'new_post' => array(
    'post_type' => 'movie',
    'post_status' => 'publish'
    ),
    'submit_value' => 'Create a new movie'
));
?>

which makes a form like this

but 'the Movie Genre' field isn't working, Thanks in advance for your time any help or suggestions are much appreciated.

I'm trying to design a form that creates a post, with the help of Advanced Custom Fields (ACF).

The post has a custom post type of 'movie' and has custom fields of type 'relationship' that link to other posts of type 'genre'.

I use this code for the form

<?php
acf_form_head();
?>


<?php
acf_form(array(
    'post_id' => 'new_post',
    'post_title' => true,
    'new_post' => array(
    'post_type' => 'movie',
    'post_status' => 'publish'
    ),
    'submit_value' => 'Create a new movie'
));
?>

which makes a form like this

but 'the Movie Genre' field isn't working, Thanks in advance for your time any help or suggestions are much appreciated.

Share Improve this question asked May 5, 2019 at 14:16 Ds RedDs Red 12 bronze badges 1
  • Can you clarify "'the Movie Genre' field isn't working"? – nmr Commented May 17, 2019 at 7:27
Add a comment  | 

1 Answer 1

Reset to default 0

If the values do not load there is either an error in JavaScript or an error in PHP during hte AJAX request.

JavaScript errors are usually caused by plugin conflicts. To begin debugging this start disabling other plugins to see if you can clear it up.

PHP errors during AJAX can be found by enabling error logging https://codex.wordpress/WP_DEBUG

发布评论

评论列表(0)

  1. 暂无评论