admin管理员组文章数量:1122846
I'm new to multisite development, and I'm struggling to answer this question: I have a Multisite network setup that I inherited, and I have been tasked with removing a few plugins network-wide.
The plugins in question are currently deactivated at the top network level, I am wondering if there's a quick check I run to see if they are individually active throughout sites on the network?
After doing a few spot checks I see the deactivated plugin as an option on some of the sub-sites, with the option to activate them individually, I assume the activation on this level will not affect the network?
There are about 50 sites total so checking each manually is not optimal.
Thanks
I'm new to multisite development, and I'm struggling to answer this question: I have a Multisite network setup that I inherited, and I have been tasked with removing a few plugins network-wide.
The plugins in question are currently deactivated at the top network level, I am wondering if there's a quick check I run to see if they are individually active throughout sites on the network?
After doing a few spot checks I see the deactivated plugin as an option on some of the sub-sites, with the option to activate them individually, I assume the activation on this level will not affect the network?
There are about 50 sites total so checking each manually is not optimal.
Thanks
Share Improve this question asked Dec 2, 2022 at 21:38 grzybowski1911grzybowski1911 898 bronze badges 1- 1 You can use "Multisite Enhancements" plugin to do this.. its old but works great still. wordpress.org/plugins/multisite-enhancements – GRRRRwordpressgrrr Commented May 14, 2023 at 21:14
2 Answers
Reset to default 0Though the question is quite old I would like to share the small code snippet with you guys.
So here is how to check whether a plugin is activated individually for some websites:
$sites = get_sites();
foreach( $sites as $site ) {
switch_to_blog( $site->blog_id );
if( in_array( 'YOUR PLUGIN TO CHECK', (array) get_option( 'active_plugins', array() ) ) ) {
// yes, it is active for $site->blog_id
}
restore_current_blog();
}
This code is fully functional, you just need to replace 'YOUR PLUGIN TO CHECK' with the actual plugin, for example woocommerce/woocommerce.php.
If you need more details about this snippet, you can find them in this tut: https://rudrastyh.com/wordpress/check-if-plugin-is-active-in-multisite.html
To check if a plugin is active on individual sites within a WordPress Multisite network, you can use the is_plugin_active_for_network function. This function takes the plugin file path as an argument and returns true if the plugin is active on the network, and false if it is not.
Here is an example of how you could use this function to check if a plugin is active on individual sites within your network:
wp plugin list --status=active --network
This will show you a list of all active plugins on the network, including the ones that are active on individual sites within the network.
本文标签: multisiteCheck Plugins in Use by Mutli Site Network
版权声明:本文标题:multisite - Check Plugins in Use by Mutli Site Network 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736294253a1929317.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论