Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This is a quick and straightforward utility that attempts to
- * purge all Facebook events from your The Events Calendar installation.
- *
- * Before use, please backup your database and ensure you know how to
- * restore that backup!
- *
- * Easiest usage is to copy and paste in to your theme's functions.php
- * file, then login and view the list of events: you may need to refresh
- * the page a couple of times or more but you should ultimately find
- * that FB-related events are dropped altogether. With that done, PLEASE
- * DELETE THIS CODE - especially if you intend to start importing more
- * FB events!
- *
- * (This is provided as a convenience, use at your own risk!)
- */
- class Kill_Tribe_FB_Events
- {
- protected $matches = array();
- public function __construct() {
- $this->find_matches();
- $this->destroy_matches();
- }
- protected function find_matches() {
- $this->matches = get_posts(array(
- 'meta_key' => '_FacebookID',
- 'post_type' => TribeEvents::POSTTYPE,
- 'posts_per_page' => -1
- ));
- }
- protected function destroy_matches() {
- foreach ($this->matches as $fb_event)
- wp_delete_post($fb_event->ID, true);
- }
- }
- // Set things in motion
- new Kill_Tribe_FB_Events;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement