Conflict on plugins_loaded hook
-
Hi there,
after a user reported a conflict between Styles and Black Studio TinyMCE Widget (see here and here), I made some debug on this and I found that the reason is related to the way Styles attaches callbacks to theplugins_loaded
hook.
There’s a first callbackStyles_Plugin::get_instance
(with default priority 10) that indirectly adds a second callbackStyles_Plugin::plugins_loaded
(with priority 15), which indirectly adds a third callbackStyles_Child::plugins_loaded
(with priority 20).
This works fine if there are not callbacks on the same hook added by other plugins with the same priority, but it’s not recommended to add actions to the same hook that is actually executing, as WordPress can not guarantee the order of execution in that (nor the execution itself).
In particular Black Studio TinyMCE Widget was having a callback attached toplugins_loaded
with priority 20, which was preventing the execution of theStyles_Child::plugins_loaded
. The latest version of BSTW 2.1.3 changed the priority to allow for compatibility, but I would recommend to implement an alternative solution, as it could bring to conflicts to other plugins too.
- The topic ‘Conflict on plugins_loaded hook’ is closed to new replies.