Change product-category-metabox scripts/styles enqueue logic (#38076)

* Update product-category-metabox JS/style enqueue logic

Change to only enqueue on product pages, not all admin pages.

* Add changelog
This commit is contained in:
Chi-Hsuan Huang 2023-05-08 17:19:12 +08:00 committed by GitHub
parent df0583f9b8
commit 880459ee9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Change product-category-metabox JS/style enqueue logic

View File

@ -46,9 +46,10 @@ class Init {
* Enqueue scripts needed for the product form block editor.
*/
public function enqueue_scripts() {
if ( ! PageController::is_admin_or_embed_page() ) {
if ( ! PageController::is_embed_page() ) {
return;
}
WCAdminAssets::register_script( 'wp-admin-scripts', 'product-category-metabox', true );
wp_localize_script(
'wc-admin-product-category-metabox',
@ -66,7 +67,7 @@ class Init {
* Enqueue styles needed for the rich text editor.
*/
public function enqueue_styles() {
if ( ! PageController::is_admin_or_embed_page() ) {
if ( ! PageController::is_embed_page() ) {
return;
}
$version = Constants::get_constant( 'WC_VERSION' );