-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.php
37 lines (34 loc) · 1.31 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
<?php
/**
* Automatically invoked when plugin is uninstalled
* We want to clear options saved in db.
*
* ref: https://developer.wordpress.org/plugins/plugin-basics/uninstall-methods/
*
* @author Wasseem Khayrattee (@wkhayrattee)
*
*
* NOTE to self:
* A plugin should always have an uninstall.php - I QUOTE:
*
* "If the plugin can not be written without running code within the plugin, then
* the plugin should create a file named 'uninstall.php' in the base plugin
* folder. This file will be called, if it exists, during the uninstall process
* bypassing the uninstall hook. The plugin, when using the 'uninstall.php'
* should always check for the 'WP_UNINSTALL_PLUGIN' constant, before
* executing."
*
* Source: https://github.com/WordPress/WordPress/blob/9dcd0110fb23b72ac4715ec1b527ba66db6ca7e4/wp-includes/plugin.php#L686-691
*/
// if uninstall.php is not called by WordPress, die
if (!defined('WP_UNINSTALL_PLUGIN')) {
die;
}
/**
* load our main file now with composer autoloading
*/
define('RINGIER_BUS_DS', DIRECTORY_SEPARATOR);
define('RINGIER_BUS_PLUGIN_DIR', plugin_dir_path(__FILE__)); //has trailing slash at end
require_once RINGIER_BUS_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'includes/vendor/autoload.php';
//Call our uninstall-cleanup process
\RingierBusPlugin\BusPluginClass::plugin_uninstall();