Closed lushkant closed 4 years ago
The solution in the comment might just work: https://developer.wordpress.org/reference/functions/is_plugin_active/#comment-2427
Snippet: if(in_array('plugin-directory/plugin-file.php', apply_filters('active_plugins', get_option('active_plugins')))){ //plugin is activated }
Once PR merged do the same here too: https://github.com/analogwp/style-kits-pro/blob/develop/style-kits-pro.php#L116
Issue
So the problem is actually with this
get_plugins()
call it works fine when it has a fallback applied like so -But with plugins using
get_plugins()
call this triggers a conflict, although I tried recreating this same behavior and couldn't which in terms points to a hard to replicate condition sometimes.The error was last seen in Yoast v14.4.1 and Toolset Types plugin (version unknown).
Stack trace for Yoast
Stack trace for Toolset Types
Fix we know so far & what we want
Having a fallback for get_plugins and re-requiring
plugin.php
from wp-admin/includes fixes this issue. But it isn't a reliable fix since this issue occurs with every other plugin who is usingget_plugins()
somewhere in their code without a similar fallback.So we're better off fixing this in our own code, we need to check if our call is early/late/a possible cause which could explain why this call conflicts with other similar calls.
Let me know @gvgvgvijayan if you need help or a hand in this. Always here to help 😄