When developing for a WordPress multisite, it is often necessary to load some custom code very early in the WordPress application’s loading sequence, e.g. to implement some custom domain mapping functionality. For multisite instances on VIP Go, we make it easy to load custom code as part of WordPress Core’s
Before discussing how, it’s important to note that
sunrise.phploads very early in WordPress, and most of its functions won’t be available. Further,
mu-plugins, any active plugins, and the active theme. As such, what can be done in
sunrise.phpis limited, and largely confined to using pure PHP to set constants that override WordPress Core behaviour.
That said, to load additional code in
sunrise.php, create a
vip-config/client-sunrise.php file in your site’s repository. When present, the file is loaded automatically (ref).
If you have any questions about using
sunrise.php in your VIP Go multisite, please feel free to get in touch and we’ll be happy to help.