Automattic\WooCommerce\Internal\Admin

Analytics::register_cache_clear_tool()publicWC 1.0

Register the cache clearing tool on the WooCommerce > Status > Tools page.

Метод класса: Analytics{}

Хуков нет.

Возвращает

Массив. Filtered debug tool registrations.

Использование

$Analytics = new Analytics();
$Analytics->register_cache_clear_tool( $debug_tools );
$debug_tools(массив) (обязательный)
Available debug tool registrations.

Код Analytics::register_cache_clear_tool() WC 8.7.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;
}