Plugin_url shouldn't be called in the global context
-
First of all, thanks for creating this plugin!
It works great, but I have encountered one issue.
I’m using the Domain mapping plugin, which filters all plugin urls.
This doesn’t work with this plugin, as it calls plugin_url() in the global plugin context.
According to the WP function reference, plugins_url() should never be called in the global context.
The plugins_url() function should not be called in the global context of plugins, but rather in a hook like "init" or "admin_init" to ensure that the "plugins_url" filters are already hooked at the time the function is called. This is vital for many site configurations to work, and if plugins_url() is called in the global context of a plugin file it cannot be filtered by other plugins (though mu-plugins are able to filter it because they run before any other plugins).
Can you move the definition of the OPTINMONSTER_API constant to the init hook, so other plugins can deal with it?
Thanks in advance,
Twan
- The topic ‘Plugin_url shouldn't be called in the global context’ is closed to new replies.