Skip Navigation

[Resolved] Not Changing Post Status on Form Submission

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

Problem: I would like to keep the post's original post status when a Form is submitted.

Solution: Choose the option "Keep the original post status" in the Form settings. Use the Forms API cred_save_data if necessary to override the selected status settings.

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api
https://codex.wordpress.org/Function_Reference/wp_update_post

This support ticket is created 6 years, 5 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Ian 6 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1083026

Ian

I have a post type for Vendor Listing that contains a large number of custom fields. When some of these fields are submitted I want the post status to change to "pending approval. When other fields are submitted I would like the post status to remain unchanged. As in if the post is published it remains published if it is pending approval it remains in that state.

I am more than happy to break this into two separate forms as this allows me to explain to vendors that making changes to the one form will result in their post going into a review process.

Is it possible to submit a form without changing the present status of the post involved

#1083222

Hi, an Edit Post Form can be set to "Keep original status" to maintain the original post status when the Form is submitted. If you would like to override that behavior programmatically based on custom field values, then you can use the Forms API to modify the post's status using wp_update_post. Depending on the criteria, you might be able to use the cred_save_data hook or the cred_before_save_data hook to manipulate the post status. We have documentation for these APIs available here:
https://toolset.com/documentation/programmer-reference/cred-api
Wordpress's function to modify a post:
https://codex.wordpress.org/Function_Reference/wp_update_post

If you need help, I will need to know more information about which fields trigger specific actions.

#1087570

Ian

Thanks