| @@ -8,8 +8,10 @@ | ||
| 8 | 8 | if (!defined('WP_UNINSTALL_PLUGIN')) { |
| 9 | 9 | die; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | +do_action('iwp/uninstall_plugin'); | |
| 13 | + | |
| 12 | 14 | // Escape if cleanup has not been enabled. |
| 13 | 15 | $uninstall_enabled = get_option('iwp_settings'); |
| 14 | 16 | if (!isset($uninstall_enabled['cleanup']) || true !== $uninstall_enabled['cleanup']) { |
| 15 | 17 | return; |
| @@ -41,9 +43,12 @@ | ||
| 41 | 43 | |
| 42 | 44 | // 2. Delete /wp-content/importwp folder |
| 43 | 45 | require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php'; |
| 44 | 46 | $fileSystemDirect = new \WP_Filesystem_Direct(false); |
| 45 | -$fileSystemDirect->rmdir(WP_CONTENT_DIR . '/uploads/importwp', true); | |
| 47 | +$upload_dir = wp_upload_dir(); | |
| 48 | + | |
| 49 | +$fileSystemDirect->rmdir($upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'importwp', true); | |
| 50 | +$fileSystemDirect->rmdir($upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'exportwp', true); | |
| 46 | 51 | |
| 47 | 52 | |
| 48 | 53 | // 3. Uninstall DB |
| 49 | 54 | $migrations = new Migrations(); |