OiO.lk Blog PHP How to disable loading of (selected) plugins while doing things in WordPress/Woocommerce
PHP

How to disable loading of (selected) plugins while doing things in WordPress/Woocommerce


I’m doing quite a number of actions on products in Woocommerce from "outside" WordPress/Woocommerce, from within a shell-environment, through scripts of my own.
For this, I "load" WordPress through wp-load.php, to be able to use the WordPress/Woocommerce-functions and some PHP-includes of my own.

This works quite well and quite a bit faster then "calling" the scripts through a browser/Curl. And this way still has the advantages of approaching the WordPress/Woocommerce-data through carefully crafted WordPress/Woocommerce-functions to keep the data "aligned".
But sometimes I get errors from plugins, that I don’t use in this environment (and could do without in this environment), but which are loaded of course, when loading the WordPress environment through wp-load.php.

Is there a simple way, to prevent loading of one or more plugins in this shell-environment (because their functionality isn’t used in this shell-environment), without switching those plugins off for the front-end?

I would not know how to prevent loading of some plugins, because I wouldn’t know where to start 😉

I looked at the deactivate_plugins() function, but that seems to deactivate the given plugin(s) for the current site as a whole, and not just in the shell-environment.



You need to sign in to view this answers

Exit mobile version