Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Mini Cart: Fix loading deps when WordPress is installed in a subdir (#…
Browse files Browse the repository at this point in the history
…6673)

* Fix loading deps when WordPress is installed in a subdir #6500

Fix loading deps when WordPress is installed in a subdir

* update logic
  • Loading branch information
gigitux authored Jul 13, 2022
1 parent 3f7d112 commit 2f74259
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/BlockTypes/MiniCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,11 @@ protected function append_script_and_deps_src( $script ) {
if ( ! $script->src ) {
return;
}

$site_url = site_url() ?? wp_guess_url();

$this->scripts_to_lazy_load[ $script->handle ] = array(
'src' => $script->src,
'src' => preg_match( '|^(https?:)?//|', $script->src ) ? $script->src : $site_url . $script->src,
'version' => $script->ver,
'before' => $wp_scripts->print_inline_script( $script->handle, 'before', false ),
'after' => $wp_scripts->print_inline_script( $script->handle, 'after', false ),
Expand Down

0 comments on commit 2f74259

Please sign in to comment.