| 1 |
<?php |
| 2 |
/** |
| 3 |
* Remove all options on uninstall |
| 4 |
* |
| 5 |
* @since 1.0.0 |
| 6 |
* @package Autoremove_Attachments |
| 7 |
*/ |
| 8 |
|
| 9 |
defined( 'WP_UNINSTALL_PLUGIN' ) || exit; |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
/** |
| 16 |
* Remove plugin options. |
| 17 |
*/ |
| 18 |
if ( is_multisite() ) { |
| 19 |
global $wpdb; |
| 20 |
|
| 21 |
// phpcs:ignore |
| 22 |
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs}", ARRAY_A ); |
| 23 |
|
| 24 |
if ( $blogs ) { |
| 25 |
foreach ( $blogs as $blog ) { |
| 26 |
switch_to_blog( $blog['blog_id'] ); |
| 27 |
|
| 28 |
delete_option( 'autoremove_attachments' ); |
| 29 |
} |
| 30 |
restore_current_blog(); |
| 31 |
} |
| 32 |
} else { |
| 33 |
delete_option( 'autoremove_attachments' ); |
| 34 |
} |
| 35 |
|