I have a RFG called company-contacts, and a post-type called reps. I have many reps, and many company contacts listed in each rep. I have a need to delete all the reps and the company contacts to start fresh. Is there an easy way to accomplish this?
I planed on using this script to clear out the reps. I think it will work, but i want to clear the database of the company contacts as well. can this be done with the same script? if so, what slug should I use? if not, how else can I delete all of the RFG data?
$allposts= get_posts( array('post_type'=>'reps','numberposts'=>-1) );
foreach ($allposts as $eachpost) {
wp_delete_post( $eachpost->ID, true );
}
Hello and thank you for contacting the Toolset support.
The following code will delete all post from the reps custom post type. Change the first line to use the RFG slug instead of the "reps" slug. Let's say the slug of the RFG is "company-contacts", use the following:
$allposts= get_posts( array('post_type'=>'company-contacts','numberposts'=>-1) );
foreach ($allposts as $eachpost) {
wp_delete_post( $eachpost->ID, true );
}
Check this screenshot for the slug from my test site. My RFG slug is "cpt-books-comments" hidden link