Cherry-pick branch/2.0.x: Fix conflict with hooks + 3.6, pre 3.6.2

This commit is contained in:
Kelly Dwan 2019-04-19 12:51:24 -04:00
parent 7bac46f286
commit cf14034f9a
2 changed files with 11 additions and 1 deletions

View File

@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products
Requires at least: 5.0
Tested up to: 5.2
Requires PHP: 5.2
Stable tag: 2.0.0
Stable tag: 2.0.1
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -83,6 +83,11 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/
== Changelog ==
= 2.0.1 - 2019-04-22 =
- Fix: Fix warnings about blocks already being registered.
- Fix: Fix a conflict with WooCommerce 3.6 and WooCommerce Blocks 1.4 (this change only applies to the version of blocks bundled with WooCommerce core).
= 2.0.0 - 2019-04-18 =
- **BREAKING:** Requires WordPress 5.0+, WooCommerce 3.6+

View File

@ -27,6 +27,11 @@ function wgpb_initialize() {
// Remove core hook in favor of our local feature plugin handler.
remove_action( 'init', array( 'WC_Block_Library', 'init' ) );
// Remove core hooks from pre-3.6 (in 3.6.2 all functions were moved to one hook on init).
remove_action( 'init', array( 'WC_Block_Library', 'register_blocks' ) );
remove_action( 'init', array( 'WC_Block_Library', 'register_assets' ) );
remove_filter( 'block_categories', array( 'WC_Block_Library', 'add_block_category' ) );
remove_action( 'admin_print_footer_scripts', array( 'WC_Block_Library', 'print_script_settings' ), 1 );
$files_exist = file_exists( plugin_dir_path( __FILE__ ) . '/build/featured-product.js' );
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && ! $files_exist ) {