forked from phillipclapham/wp-posts-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
65 lines (60 loc) · 1.68 KB
/
uninstall.php
File metadata and controls
65 lines (60 loc) · 1.68 KB
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
62
63
64
65
<?php
/**
* Posts Grid Uninstall
*
* Fired when the plugin is deleted (not deactivated).
* Removes all plugin options from the database.
*
* @package PostsGrid
*/
// Exit if not called by WordPress
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
/**
* Remove all plugin options from the database
*/
function posts_grid_uninstall() {
// All option names used by the plugin
$options = array(
// Typography
'posts_grid_title_size',
'posts_grid_title_weight',
'posts_grid_title_line_height',
'posts_grid_excerpt_size',
'posts_grid_excerpt_line_height',
'posts_grid_date_size',
// Layout
'posts_grid_grid_gap',
'posts_grid_image_ratio',
'posts_grid_border_radius',
'posts_grid_content_padding',
// Colors
'posts_grid_title_color',
'posts_grid_title_hover_color',
'posts_grid_excerpt_color',
'posts_grid_date_color',
// Display Defaults
'posts_grid_default_columns',
'posts_grid_default_show_excerpt',
'posts_grid_default_show_date',
'posts_grid_default_show_image',
'posts_grid_default_excerpt_length',
);
// Delete each option
foreach ( $options as $option ) {
delete_option( $option );
}
// For multisite, also clean up each blog
if ( is_multisite() ) {
$sites = get_sites( array( 'fields' => 'ids' ) );
foreach ( $sites as $site_id ) {
switch_to_blog( $site_id );
foreach ( $options as $option ) {
delete_option( $option );
}
restore_current_blog();
}
}
}
posts_grid_uninstall();