• Resolved goldfoot

    (@goldfoot)


    The URL to resources of the plugin (CSS / JS) gets generated in the global context of the plugin. Thus, changes to the URL that are done via filters do not get applied. An example of this is when Foobox is used with the Polylang plugin: If an individual URL for each language is configured, Foobox always references the resources using the site_url, disregarding the domain for an additional language. This leads to the resources not being loaded due to Cross-Origin-Resource-Sharing being restricted in most browsers.

    The URLs of the resources should be called in a hook and not in the global context of the plugin, i.e. in the function register_and_enqueue_css() in file free/includes/classes/class-foo-plugin-base.php (please also see here).

    • This topic was modified 6 years, 2 months ago by goldfoot.
    • This topic was modified 6 years, 2 months ago by goldfoot. Reason: Updated link to function reference
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Call plugins_url in a hook’ is closed to new replies.