WC_Helper_Updater::block_expired_updates( bool $reply, string $package )

Hooked into the upgrader_pre_download filter in order to better handle error messaging around expired plugin updates. Initially we were using an empty string, but the error message that no_package results in does not fit the cause.


Description Description


Parameters Parameters

$reply

(Required) Holds the current filtered response.

$package

(Required) The path to the package file for the update.


Top ↑

Return Return

(false|WP_Error) False to proceed with the update as normal, anything else to be returned instead of updating.


Top ↑

Source Source

File: includes/admin/helper/class-wc-helper-updater.php

	public static function block_expired_updates( $reply, $package ) {
		// Don't override a reply that was set already.
		if ( false !== $reply ) {
			return $reply;
		}

		// Only for packages with expired subscriptions.
		if ( 0 !== strpos( $package, 'woocommerce-com-expired-' ) ) {
			return false;
		}

		return new WP_Error(
			'woocommerce_subscription_expired',
			sprintf(
				// translators: %s: URL of WooCommerce.com subscriptions tab.
				__( 'Please visit the <a href="%s" target="_blank">subscriptions page</a> and renew to continue receiving updates.', 'woocommerce' ),
				esc_url( admin_url( 'admin.php?page=wc-addons&section=helper' ) )
			)
		);
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.