tyxla / WP-Hydra

Allows one WordPress installation to be resolved and browsed at multiple domains.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fonts from other plugins not loaded URLs not being modified

easterncoder opened this issue · comments

Hi,

Mike here, WishList Member developer. A client of ours reached out to us saying that our plugin's icon fonts are not loading properly when using WP Hydra. I tracked down the issue to this:

  1. WishList Member uses plugins_url() in its constructor and assign it to a variable for later use in enqueueing scripts and styles
  2. WP Hydra loads its hooks after WishList Member's constructor runs Since WLM called plugins_url() called before WP Hydra was loaded, no domain modifications were made to it.
  3. WishList Member then enqueues/registers scripts and styles using the variable it created in step 1

I suggest adding the following to WP Hydra

add_filter( 'style_loader_src', array( $this, 'setup_domain' ), 1 );
add_filter( 'script_loader_src', array( $this, 'setup_domain' ), 1 );

This ensures that WP Hydra will change URLs for scripts and styles that it missed due to the above scenario before said said scripts and styles are outputted. I believe this change will make WP Hydra work better not just with WishList Member but perhaps with other plugins as well.

Thanks.

Patch attached.
patch1.txt