wpcf7_delete_plugin

The Contact Form 7 wpcf7 delete plugin function.

Description

wpcf7_delete_plugin(); 

Usage

  1. if ( !function_exists( 'wpcf7_delete_plugin' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/uninstall.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wpcf7_delete_plugin(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/uninstall.php  
  1. function wpcf7_delete_plugin() { 
  2. global $wpdb; 
  3.  
  4. delete_option( wpcf7 ); 
  5.  
  6. $posts = get_posts( 
  7. array( 
  8. 'numberposts' => -1,  
  9. 'post_type' => 'wpcf7_contact_form',  
  10. 'post_status' => 'any',  
  11. ); 
  12.  
  13. foreach ( $posts as $post ) { 
  14. wp_delete_post( $post->ID, true ); 
  15.  
  16. $wpdb->query( sprintf( "DROP TABLE IF EXISTS %s",  
  17. $wpdb->prefix . 'contact_form_7' ) );