Skip Navigation

[Resolved] How to safely bulk delete attachments from a Toolset custom field

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
- 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 3 replies, has 1 voice.

Last updated by simonM-5 5 days, 13 hours ago.

Assisted by: Minesh.

Author
Posts
#2812798

Hi Support

I would like as a WordPress Admin to bulk delete a lot of PDF documents uploaded by users on the front end via Toolset forms into Toolset custom fields.

I want to make sure the documents are deleted cleanly and leave no remnants behind (for example, dead links or URLs, postmeta or other orphaned data in database tables).

I have read elsewhere that deleting them in the Media Library would not be sufficient to achieve 100% clean deletion.
What is your recommended approach?

Kind regards
Simon

#2812826

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

As per WordPress standard, Toolset store custom field value to postmeta table.

So, in cause of PDF, you will require to delete the unwanted PDFs from media library as well as from the postmeta table. So, if you have a custom field "book-image" the post meta key stored to database table postmeta as "wpcf-book-image".

Please make sure you delete the unwanted entries only otherwise it will cause chaos for items you want as well.

*** Please make a FULL BACKUP of your database and website.***

Maybe you want to try plugins that may help you:
- https://wordpress.org/plugins/advanced-database-cleaner/

#2813067

Hi Minesh

Thanks for your insights. As you know, our site is a WPML site too. What entries are made into which tables when the documents/media are "translated"? I guess they would have to be cleaned up too.

Thanks and regards
Simon

#2813173

Minesh
Supporter

Languages: English (English )

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

*** Please make a FULL BACKUP of your database and website.***

Please check the following related ticket that might help you to delete the media translation for specific language:
- https://wpml.org/forums/topic/how-to-delete-language-content-from-database/#post-14298321
- https://wpml.org/forums/topic/media-translation-keep-the-same-images-without-duplication-or-translation/

More info:
- https://wpml.org/documentation/getting-started-guide/language-setup/deleting-languages-and-plugin-data-by-doing-a-wpml-reset-on-your-site/#step-1-remove-the-secondary-languages-and-all-existing-translations

You can use any of the solution that best suites your requirement mentioned with the above related tickets/Doc.

#2813496

Hi Minesh

That should be enough info for me to complete the task.

Thanks and regards
Simon