wp-job-manager
Last commit date
assets
3 weeks ago
includes
2 weeks ago
languages
2 weeks ago
lib
3 weeks ago
templates
3 weeks ago
vendor
2 weeks ago
LICENSE
5 years ago
changelog.txt
2 weeks ago
readme.txt
1 week ago
uninstall.php
2 years ago
wp-job-manager-autoload.php
2 years ago
wp-job-manager-deprecated.php
2 years ago
wp-job-manager-functions.php
3 weeks ago
wp-job-manager-template.php
2 months ago
wp-job-manager.php
1 week ago
wpml-config.xml
2 years ago
uninstall.php
48 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Uninstall file for the plugin. Runs when plugin is deleted in WordPress Admin. |
| 4 | * |
| 5 | * @package wp-job-manager |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 9 | exit(); |
| 10 | } |
| 11 | |
| 12 | // Cleanup all data. |
| 13 | require 'includes/class-wp-job-manager-post-types.php'; |
| 14 | require 'includes/class-wp-job-manager-data-cleaner.php'; |
| 15 | |
| 16 | if ( ! is_multisite() ) { |
| 17 | |
| 18 | // Only do deletion if the setting is true. |
| 19 | $do_deletion = get_option( 'job_manager_delete_data_on_uninstall' ); |
| 20 | if ( $do_deletion ) { |
| 21 | WP_Job_Manager_Data_Cleaner::cleanup_all(); |
| 22 | } |
| 23 | } elseif ( function_exists( 'get_sites' ) ) { |
| 24 | $blog_ids = get_sites( |
| 25 | [ |
| 26 | 'fields' => 'ids', |
| 27 | 'update_site_cache' => false, |
| 28 | ] |
| 29 | ); |
| 30 | |
| 31 | $original_blog_id = get_current_blog_id(); |
| 32 | |
| 33 | foreach ( $blog_ids as $current_blog_id ) { |
| 34 | switch_to_blog( $current_blog_id ); |
| 35 | |
| 36 | // Only do deletion if the setting is true. |
| 37 | $do_deletion = get_option( 'job_manager_delete_data_on_uninstall' ); |
| 38 | if ( $do_deletion ) { |
| 39 | WP_Job_Manager_Data_Cleaner::cleanup_all(); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | switch_to_blog( $original_blog_id ); |
| 44 | } |
| 45 | |
| 46 | require dirname( __FILE__ ) . '/includes/class-wp-job-manager-usage-tracking.php'; |
| 47 | WP_Job_Manager_Usage_Tracking::get_instance()->clear_options(); |
| 48 |