uninstall.php
| 1 | <?php |
| 2 | |
| 3 | if ( |
| 4 | !defined( 'WP_UNINSTALL_PLUGIN' ) |
| 5 | || |
| 6 | !WP_UNINSTALL_PLUGIN |
| 7 | || |
| 8 | dirname( WP_UNINSTALL_PLUGIN ) != dirname( plugin_basename( __FILE__ ) ) |
| 9 | ) { |
| 10 | status_header( 404 ); |
| 11 | exit; |
| 12 | } |
| 13 | |
| 14 | define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 15 | |
| 16 | // Delete all compact options |
| 17 | delete_option( 'jetpack_options' ); |
| 18 | |
| 19 | // Delete all non-compact options |
| 20 | delete_option( 'jetpack_register' ); |
| 21 | delete_option( 'jetpack_activated' ); |
| 22 | delete_option( 'jetpack_active_modules' ); |
| 23 | delete_option( 'jetpack_do_activate' ); |
| 24 | |
| 25 | // Delete all legacy options |
| 26 | delete_option( 'jetpack_was_activated' ); |
| 27 | delete_option( 'jetpack_auto_installed' ); |
| 28 | delete_transient( 'jetpack_register' ); |
| 29 | |
| 30 | // Do not initialize any listeners. |
| 31 | // Since all the files will be deleted. |
| 32 | // No need to try to sync anything. |
| 33 | add_filter( 'jetpack_sync_modules', '__return_empty_array', 100 ); |
| 34 | |
| 35 | // Jetpack Sync |
| 36 | require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-sender.php'; |
| 37 | Jetpack_Sync_Sender::get_instance()->uninstall(); |
| 38 |