Support

Account

Home Forums General Issues Conneting posts to parent posts via forms on the front-end

Helping

Conneting posts to parent posts via forms on the front-end

  • Is there a way to add a post to a parent by putting the acf form group I created in the page’s template? What I would like to do is have a form on a event page that creates a ‘person’ under the ‘registrants’ post type I created. When that ‘person’ post is created, they are added under that event post_id as a child.

    As an example:

    
    <?php acf_form(array(
    					'post_id'		=> 'new_post',
    					'new_post'		=> array(
    						'post_type'		=> 'people',
    						'post_status'		=> 'publish'
    					),
    					'submit_value'		=> 'Submit'
    				)); ?>

    Let’s say that this code is on an event-single.php page, in the new_post array can I link the newly created people post to the id of the page that the form is currently on (which is the page of a single event) and make it the people post’s parent?

    Is there something already set in acf to do this? Or is there any documentation on how to mod the forms to make this connection?

    Thanks.

  • How is the post parent page stored on in the people post type? Since you’re talking about a post type being a child of another post type, is there another plugin that creates this relationship? You’ll need to know how this is stored and how to updated it or set it.

    Also, what version of ACF are you using?

    With this information I may be able to help you figure out a way to do this.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Conneting posts to parent posts via forms on the front-end’ is closed to new replies.