“How can you change things in your “functions.php” for a specific tenant?”
Support: Multi-tenant WordPress means several individual sites run based on the same application code. Included in this are the Plugins, Language files, and Theme files.
As functions.php is part of your theme, it means if you edit the functions.php for one of the sites, you change them for all.
Since editing code should not happen without organization and administration, and this ultimately should be tested, we provide the versioning system.
? In short: The functions file is part of the WordPress theme. The theme is part of the multi-tenancy. You centrally edit the functions.php using Version Management.
Safe development with Version Management #
Using the versioning system, you can include a custom plugin to add code instead of using functions.php. That way, you can put it in a repository and have historical information.
If you need site-specific edits, it gets a bit more complicated (because of the shared code aspect of multitenancy). You would need to build in something to identify the sites by.
This also makes your functions file or custom plugin larger than it needs to be. At a certain point, whether this suits multitenancy needs to be asked.
I want to add here that if it is about one-off changes, you can always use something like Adminer if you want to. But we stress proper administration for site-specific changes in such cases, as using a plugin for one-off changes often increases cognitive load.
Using the WPCS CLI #
FTP access is restricted inside the WPCS Console to ensure the uniformity of your application. Instead, you can access FTP using our CLI and develop locally (LocalWP) or via Git.
I’ve embedded this webinar below that details how to use our CLI to build a product using LocalWP that includes a must-use plugin, including custom code.
SSH access is restricted due to the short-lived nature of containers. Your tenants run on containers, making the WPCS platform scalable and serverless. Containers scale up and down depending on site traffic.
If you’d like to discuss your personal use case, please get in touch with us via the chat in the WPCS console.
You can start a free trial and experience the benefits of multi-tenant WordPress at WPCS.io.