diff --git a/composer.json b/composer.json index d33f48a..99c07dc 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "afragen/wp-dismiss-notice", "description": "Library for time dismissible WordPress admin notices.", - "version": "0.3.6", + "version": "0.3.7", "type": "library", "license": "MIT", "authors": [ diff --git a/wp-dismiss-notice.php b/wp-dismiss-notice.php index c913101..ad669ef 100644 --- a/wp-dismiss-notice.php +++ b/wp-dismiss-notice.php @@ -39,6 +39,14 @@ class WP_Dismiss_Notice { */ $vendor_dir = apply_filters( 'dismiss_notice_vendor_dir', '/vendor' ); $composer_js_path = untrailingslashit( $vendor_dir ) . '/afragen/wp-dismiss-notice/js/dismiss-notice.js'; + + $theme_js_url = get_theme_file_uri( $composer_js_path ); + $theme_js_file = parse_url( $theme_js_url, PHP_URL_PATH ); + + if ( file_exists( ABSPATH . $theme_js_file ) ) { + $js_url = $theme_js_url; + } + if ( '/vendor' !== $vendor_dir ) { $js_url = home_url( $composer_js_path ); }