Skip Navigation

[Resolved] Bulk edit using View and CRED

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

Problem: Is it possible to bulk edit posts using CRED / Forms?

Solution: Create a View that lists the posts you want to edit. Then, instead of the Post, you insert a Form, that edits the Post, in the View's Loop section.

Once the View is inserted to a page, will show a list of forms, where you can edit each post in a single action.

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

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 randallH-3 6 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1071207

Is there a way to bulk edit using filtered View and CRED?

#1071237

If you mean to edit many posts with one form, no.
If you mean the same as in the WordPress backend, where you can select a certain amount of posts and choose "edit" in the bulk actions, as well, no.

But what is possible, is creating a View, that lists your posts you want to edit.
Then, instead of the Post, you insert a Form, that edits the Post, in the View's Loop section.

That - once the View is inserted to a page, will show a list of forms, where you can edit each post in a single action.

To bulk update or edit, it would require elaborated custom code that is out of our Support Scope, however, maybe a contractor is willing to try creating something similar:
https://toolset.com/contractors/

This is not an easy task as you need somehow to pull all data from all posts in one form and edit it there.

If you instead just want to update ALL posts with the SAME value, this is easy.
You would create ONE form that addresses any post, and you would apply Custom Code that then updates ALL posts of your choice - and hook that to a Toolset Forms API Call (cred_save_data)

For example you have a Form that lets you edit a Title
That value can be grabbed from the $_POST of the Form when you submit it, and can be passed to all other posts you tell the code to update.

If you need a technical example of this code, let me know
Here is the documentation that can be used as reference to create this:
The Forms Hook to use: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
The WordPress API To update all posts: https://codex.wordpress.org/Function_Reference/wp_update_post
The WordPress API to get all posts of a kind: https://codex.wordpress.org/Function_Reference/get_posts

In this case you do not need to use Views but only a Form on a single page.
It will be more difficult if you want the user to select certain posts to bulk edit, that will require much more custom code in the actual page to capture the $_POST data the user selected and create a query by those criteria, and update those posts with the data the user entered in the actual form.

#1075202

Okay, thank you.