Skip Navigation

[Closed] Remove all unwanted RFG

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

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 3 years, 2 months ago.

Author
Posts
#2232513
Screenshot 2021-11-29 at 11.11.57 PM.png
Screenshot 2021-11-29 at 11.08.31 PM.png

Dear Sir/Madam,

I wrongly added total 94 RFG to my custom post, how can I remove them all at once rather than remove them one by one?

#2232565

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

You could write a snippet of PHP to delete the underlying posts. Adding the code at Toolset > Settings > Custom Code would work well, because rather than activate it you have the option to run it just once, which is what you will need.

RFGs are stored as child posts of the post they have been added to.

You can use the relationships API, specifically the function toolset_get_related_posts to retrieve the child RFGs of the post in question, and then loop over the array of results in a for each loop and use wp_delete_post to delete the RFG (and its associated fields).

See

https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
https://developer.wordpress.org/reference/functions/wp_delete_post/

(Note that the relationship slug is the slug of the RFG.)

The topic ‘[Closed] Remove all unwanted RFG’ is closed to new replies.