Automattic\WooCommerce\Internal\Admin
Analytics::register_cache_clear_tool
Register the cache clearing tool on the WooCommerce > Status > Tools page.
Method of the class: Analytics{}
No Hooks.
Returns
Array. Filtered debug tool registrations.
Usage
$Analytics = new Analytics(); $Analytics->register_cache_clear_tool( $debug_tools );
- $debug_tools(array) (required)
- Available debug tool registrations.
Analytics::register_cache_clear_tool() Analytics::register cache clear tool code WC 10.5.0
public function register_cache_clear_tool( $debug_tools ) {
$settings_url = add_query_arg(
array(
'page' => 'wc-admin',
'path' => '/analytics/settings',
),
get_admin_url( null, 'admin.php' )
);
$debug_tools[ self::CACHE_TOOL_ID ] = array(
'name' => __( 'Clear analytics cache', 'woocommerce' ),
'button' => __( 'Clear', 'woocommerce' ),
'desc' => sprintf(
/* translators: 1: opening link tag, 2: closing tag */
__( 'This tool will reset the cached values used in WooCommerce Analytics. If numbers still look off, try %1$sReimporting Historical Data%2$s.', 'woocommerce' ),
'<a href="' . esc_url( $settings_url ) . '">',
'</a>'
),
'callback' => array( $this, 'run_clear_cache_tool' ),
);
return $debug_tools;
}