Created
August 21, 2020 23:16
-
-
Save timmyc/2d4d362de2241442c5792f6b87a1bf2e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WooCommerce Remove Admin Version Option | |
* Plugin URI: https://woocommerce.com | |
* Description: Adds a tool to the WooCommerce > Status > Tools page to remove the woocommerce_admin_version option | |
* Author: WooCommerce | |
* Domain Path: /languages | |
* Version: 0.1 | |
*/ | |
/** | |
* Register the cache clearing tool on the WooCommerce > Status > Tools page. | |
* | |
* @param array $debug_tools Available debug tool registrations. | |
* @return array Filtered debug tool registrations. | |
*/ | |
function woocommerce_remove_woocommerce_admin_version_option_add_tool( $debug_tools ) { | |
$debug_tools[ 'remove_woocommerce_admin_version_option' ] = array( | |
'name' => __( 'Remove WooCommerce Admin Version Option', 'woocommerce' ), | |
'button' => __( 'Remove', 'woocommerce' ), | |
'desc' => 'This tool removes the woocommerce_admin_version option to trigger database migrations to run again', | |
'callback' => 'woocommerce_remove_woocommerce_admin_version_option_delete', | |
); | |
return $debug_tools; | |
} | |
function woocommerce_remove_woocommerce_admin_version_option_delete() { | |
delete_option( 'woocommerce_admin_version' ); | |
} | |
function woocommerce_remove_woocommerce_admin_version_option_filter() { | |
add_filter( 'woocommerce_debug_tools', 'woocommerce_remove_woocommerce_admin_version_option_add_tool' ); | |
} | |
add_action( 'woocommerce_init', 'woocommerce_remove_woocommerce_admin_version_option_filter' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment