Skip Navigation

[Resolved] How to create multiple entries posts using CRED form

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to create multiple entries posts using CRED form

Solution:
CRED forms can be attached to single post type and hence you can not create multiple entries using single CRED form BUT you can use CRED API hook cred_save_data to add your custom logic using which you can create multiple entries using CRED form.

You can use CRED hook: cred_save_data

Now, using above hook you can create child entry using the WordPress function - wp_insert_post :

You can find the proposed solution with the reply here

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/cred-api/#csd
=> https://developer.wordpress.org/reference/functions/wp_insert_post/

This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by oliverD 7 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#552385
submission.jpg

Tell us what you are trying to do? I am trying to create a form that submits to 3 content types at the same time. See Image attached

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#552467

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - CRED forms can be attached to single post type and hence you can not create multiple entries using single CRED form BUT you can use CRED API hook cred_save_data to add your custom logic using which you can create multiple entries using CRED form.

You can use CRED hook: cred_save_data
=> https://toolset.com/documentation/user-guides/cred-api/#csd

Now, using above hook you can create child entry using the WordPress function - wp_insert_post:
=> https://developer.wordpress.org/reference/functions/wp_insert_post/

#553007

do you have any examples that you can share?

#553011

How would you propose to structure this from a user type and post type perspective. I.e. should all the information about the parent be in a user type or should it be split in someway between a user type and a post type. I ask this as I have identifiied recently that there are limitations on user types.

#553014

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - as I stated before you can use only one form and you can not mix user fields with post fields and if you do so it will need custom programming and custom logical structure.

If you still want to do that you need to define your structure so that if will create user account and you will have all the field information available posted by CRED form with $_POST PHP global and you can use cred_save_data hook to capture the post values by CRED form and you should create post entries accordingly.

You can use CRED hook: cred_save_data
=> https://toolset.com/documentation/user-guides/cred-api/#csd

Now, using above hook you can create child entry using the WordPress function - wp_insert_post:
=> https://developer.wordpress.org/reference/functions/wp_insert_post/

#553339

Hi, thanks for this.
Do you know of a tread with an example. I am fine with the coding but would rather do things properly from the start.
Thanks

#553375

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I do not have the exact example to share but you can refer the following link where used tried to add new post entry using CRED hook cred_save_data.
=> https://toolset.com/forums/topic/post-title-set-to-auto-draft/#post-301605

#554651

I will build custom form and coding