WC_Admin_Notices::maybe_add_legacy_api_removal_notice()
Add an admin notice about unsupported webhooks with Legacy API payload if at least one of these exist and the Legacy REST API plugin is not installed.
Метод класса: WC_Admin_Notices{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = WC_Admin_Notices::maybe_add_legacy_api_removal_notice();
Код WC_Admin_Notices::maybe_add_legacy_api_removal_notice() WC Admin Notices::maybe add legacy api removal notice WC 9.7.1
private static function maybe_add_legacy_api_removal_notice() { if ( wc_get_container()->get( WebhookUtil::class )->get_legacy_webhooks_count() > 0 && ! WC()->legacy_rest_api_is_available() ) { self::add_custom_notice( 'legacy_webhooks_unsupported_in_woo_90', sprintf( '%s%s', sprintf( '<h4>%s</h4>', esc_html__( 'WooCommerce webhooks that use the Legacy REST API are unsupported', 'woocommerce' ) ), sprintf( // translators: Placeholders are URLs. wpautop( __( '⚠️ The WooCommerce Legacy REST API has been removed from WooCommerce, this will cause <a href="%1$s">webhooks on this site that are configured to use the Legacy REST API</a> to stop working. <a target="_blank" href="%2$s">A separate WooCommerce extension is available</a> to allow these webhooks to keep using the Legacy REST API without interruption. You can also edit these webhooks to use the current REST API version to generate the payload instead. <b><a target="_blank" href="%3$s">Learn more about this change.</a></b>', 'woocommerce' ) ), admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks&legacy=true' ), 'https://wordpress.org/plugins/woocommerce-legacy-rest-api/', 'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/' ) ) ); } }