Plugin code
This commit is contained in:
parent
8819c70d0e
commit
2fde6edfdc
28 changed files with 6338 additions and 0 deletions
55
uninstall.php
Normal file
55
uninstall.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* Fired when the plugin is uninstalled.
|
||||
*
|
||||
* When populating this file, consider the following flow
|
||||
* of control:
|
||||
*
|
||||
* - This method should be static
|
||||
* - Check if the $_REQUEST content actually is the plugin name
|
||||
* - Run an admin referrer check to make sure it goes through authentication
|
||||
* - Verify the output of $_GET makes sense
|
||||
* - Repeat with other user roles. Best directly by using the links/query string parameters.
|
||||
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
|
||||
*
|
||||
* This file may be updated more in future version of the Boilerplate; however, this is the
|
||||
* general skeleton and outline for how the file should work.
|
||||
*
|
||||
* For more information, see the following discussion:
|
||||
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
|
||||
*
|
||||
* @link http://example.com
|
||||
* @since 0.1.0
|
||||
*
|
||||
* @package Woocommerce_Direct_Links
|
||||
*/
|
||||
|
||||
// If uninstall not called from WordPress, then exit.
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$post_args = array(
|
||||
'post_type' => array( 'product_variation', 'product' ),
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => -1,
|
||||
'fields' => 'ids',
|
||||
);
|
||||
|
||||
$query = new WP_Query( $post_args );
|
||||
|
||||
foreach ( $query->posts as $product ) {
|
||||
delete_post_meta( $product, 'bitly_link' );
|
||||
delete_post_meta( $product, 'joturl_link' );
|
||||
delete_post_meta( $product, 'yourls_link' );
|
||||
delete_post_meta( $product, 'tinyurl_link' );
|
||||
}
|
||||
|
||||
delete_option( 'url_options' );
|
||||
delete_option( 'yourls_domain' );
|
||||
delete_option( 'joturl_public' );
|
||||
delete_option( 'tinyurl_domain' );
|
||||
delete_option( 'joturl_private' );
|
||||
delete_option( 'yourls_signature' );
|
||||
delete_option( 'bitly_access_token_options' );
|
||||
delete_option( 'tinyurl_access_token_options' );
|
Loading…
Add table
Add a link
Reference in a new issue