Check that the translation function exists before using it (https://github.com/woocommerce/woocommerce-blocks/pull/150)

This commit is contained in:
Kelly Dwan 2018-11-21 16:10:16 -05:00 committed by GitHub
parent f09a4efae2
commit aec2d567e2
1 changed files with 3 additions and 1 deletions

View File

@ -99,7 +99,9 @@ function wgpb_extra_gutenberg_scripts() {
);
wp_localize_script( 'woocommerce-products-block-editor', 'wc_product_block_data', $product_block_data );
wp_set_script_translations( 'woocommerce-products-category-block', 'woocommerce' );
if ( function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( 'woocommerce-products-category-block', 'woocommerce' );
}
wp_enqueue_script( 'woocommerce-products-block-editor' );
wp_enqueue_script( 'woocommerce-products-category-block' );