| 1 |
<?php |
| 2 |
/** |
| 3 |
* Uninstaller |
| 4 |
* |
| 5 |
* Uninstall the plugin by removing any options from the database. |
| 6 |
* |
| 7 |
* @package simple-embed-code |
| 8 |
*/ |
| 9 |
|
| 10 |
// If the uninstall was not called by WordPress, exit. |
| 11 |
|
| 12 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
// Delete any options. |
| 17 |
|
| 18 |
if ( is_multisite() ) { |
| 19 |
|
| 20 |
// Loop through every sub-site and remove its options. |
| 21 |
|
| 22 |
$sites = get_sites( |
| 23 |
array( |
| 24 |
'fields' => 'ids', |
| 25 |
), |
| 26 |
); |
| 27 |
|
| 28 |
foreach ( $sites as $site_id ) { |
| 29 |
switch_to_blog( $site_id ); |
| 30 |
delete_option( 'artiss_code_embed' ); |
| 31 |
delete_option( 'code_embed_version' ); |
| 32 |
restore_current_blog(); |
| 33 |
} |
| 34 |
} else { |
| 35 |
|
| 36 |
// Delete options for a single site installation. |
| 37 |
|
| 38 |
delete_option( 'artiss_code_embed' ); |
| 39 |
delete_option( 'code_embed_version' ); |
| 40 |
} |
| 41 |
|