Is there a way to overwrite defines from different files?
I'm trying to make an interface for updating all instances of a WordPress
plugin on a server that hosts 20+ WordPress sites. I've got everything
working except for the fact that I have a loop with:
require_once($path.'/wp-load.php');
require_once($path.'/wp-admin/includes/admin.php');
require_once($path.'/wp-admin/includes/class-wp-upgrader.php');
where $path is equal to a website directory ($path changes with every
iteration of my loop).
The reason I need to require the files this way is because wp-load.php
includes (among other things) a file called wp-config.php, which defines
things like the SQL database, which is different between each website.
TL&DR and stating my actual question:
Is there any way for me to do something like the following code?
require_once("dir1/a.php"); // define("VAR","dir1");
echo VAR; // displays "dir1"
unrequire_once("dir1/a.php");
require_once("dir2/a.php"); // define("VAR","dir2");
echo VAR; // displays "dir2"
No comments:
Post a Comment