| 1 |
<?php |
| 2 |
/** |
| 3 |
* CustomPermalinks Uninstall |
| 4 |
* |
| 5 |
* Deletes Option and Post Permalinks on uninstalling the Plugin. |
| 6 |
* |
| 7 |
* @package CustomPermalinks |
| 8 |
* @since 1.2.18 |
| 9 |
*/ |
| 10 |
|
| 11 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
delete_post_meta_by_key( 'custom_permalink' ); |
| 16 |
delete_option( 'custom_permalink_table' ); |
| 17 |
delete_option( 'custom_permalinks_post_types_settings' ); |
| 18 |
|
| 19 |
$wp_role = get_role( 'administrator' ); |
| 20 |
if ( ! empty( $wp_role ) ) { |
| 21 |
$wp_role->remove_cap( 'cp_view_post_permalinks' ); |
| 22 |
$wp_role->remove_cap( 'cp_view_category_permalinks' ); |
| 23 |
$wp_role->remove_cap( 'custom_permalinks_post_settings' ); |
| 24 |
} |
| 25 |
|
| 26 |
$wp_role = get_role( 'custom_permalinks_manager' ); |
| 27 |
if ( ! empty( $wp_role ) ) { |
| 28 |
$wp_role->remove_cap( 'cp_view_post_permalinks' ); |
| 29 |
$wp_role->remove_cap( 'cp_view_category_permalinks' ); |
| 30 |
$wp_role->remove_cap( 'custom_permalinks_post_settings' ); |
| 31 |
|
| 32 |
remove_role( 'custom_permalinks_manager' ); |
| 33 |
} |
| 34 |
|
| 35 |
// Clear any cached data that has been removed. |
| 36 |
wp_cache_flush(); |
| 37 |
|