-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathuninstall.php
61 lines (50 loc) · 2.29 KB
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Plugin uninstall file.
*
* @package CustomContentPortfolio
* @author Justin Tadlock <[email protected]>
* @copyright Copyright (c) 2013-2017, Justin Tadlock
* @link https://themehybrid.com/plugins/custom-content-portfolio
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
// Make sure we're actually uninstalling the plugin.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) )
wp_die( sprintf( __( '%s should only be called when uninstalling the plugin.', 'custom-content-portfolio' ), '<code>' . __FILE__ . '</code>' ) );
/* === Delete plugin options. === */
// Remove pre-1.0.0 options.
delete_option( 'plugin_custom_content_portfolio' );
// Remove 1.0.0+ options.
delete_option( 'ccp_settings' );
delete_option( 'ccp_sticky_projects' );
/* === Remove capabilities added by the plugin. === */
// Get the administrator role.
$role = get_role( 'administrator' );
// If the administrator role exists, remove added capabilities for the plugin.
if ( ! is_null( $role ) ) {
// Remove pre-1.0.0 caps.
$role->remove_cap( 'manage_portfolio' );
$role->remove_cap( 'create_portfolio_items' );
$role->remove_cap( 'edit_portfolio_items' );
// Taxonomy caps.
$role->remove_cap( 'manage_portfolio_categories' );
$role->remove_cap( 'edit_portfolio_categories' );
$role->remove_cap( 'delete_portfolio_categories' );
$role->remove_cap( 'assign_portfolio_categories' );
$role->remove_cap( 'manage_portfolio_tags' );
$role->remove_cap( 'edit_portfolio_tags' );
$role->remove_cap( 'delete_portfolio_tags' );
$role->remove_cap( 'assign_portfolio_tags' );
// Post type caps.
$role->remove_cap( 'create_portfolio_projects' );
$role->remove_cap( 'edit_portfolio_projects' );
$role->remove_cap( 'edit_others_portfolio_projects' );
$role->remove_cap( 'publish_portfolio_projects' );
$role->remove_cap( 'read_private_portfolio_projects' );
$role->remove_cap( 'delete_portfolio_projects' );
$role->remove_cap( 'delete_private_portfolio_projects' );
$role->remove_cap( 'delete_published_portfolio_projects' );
$role->remove_cap( 'delete_others_portfolio_projects' );
$role->remove_cap( 'edit_private_portfolio_projects' );
$role->remove_cap( 'edit_published_portfolio_projects' );
}