| 1 |
<?php |
| 2 |
/** |
| 3 |
* Uninstall handler: removes plugin transients and options. |
| 4 |
* |
| 5 |
* @package Online_Active_Users |
| 6 |
*/ |
| 7 |
|
| 8 |
// If uninstall is not called from WordPress, exit. |
| 9 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 10 |
exit(); |
| 11 |
} |
| 12 |
|
| 13 |
// Delete plugin transient. |
| 14 |
delete_transient( 'users_status' ); |
| 15 |
|
| 16 |
// Delete all custom transients. |
| 17 |
$wpoau_stored_keys = get_option( 'wpoau_transient_keys', array() ); |
| 18 |
if ( ! empty( $wpoau_stored_keys ) ) { |
| 19 |
foreach ( $wpoau_stored_keys as $wpoau_key ) { |
| 20 |
delete_transient( $wpoau_key ); |
| 21 |
} |
| 22 |
delete_option( 'wpoau_transient_keys' ); |
| 23 |
} |
| 24 |
|
| 25 |
// Optional: Clear cache. |
| 26 |
wp_cache_flush(); |
| 27 |
|