This week, we successfully migrated a client’s website to WP Engine, a move that brought to light an unexpected challenge inherent in the WP Engine platform.
Initially set up by the original developer, the site was configured to utilize custom directories for both wp-content and wp-content/uploads—let’s refer to them as “stuff” and “stuff/things” for this discussion.
Upon migration, a glaring issue arose: the uploads URL was incorrect, causing a display error for uploaded media on the site. The problem lay in the wp-config.php file, where the UPLOADS definition was inaccurately mapped to “stuff/uploads.” A simple correction to “stuff/things” rectified this, restoring the display of uploaded media on the site.
However, the intricacies of WP Engine’s directory structure presented another hurdle. WP Engine had placed its MU Plugins into wp-content/mu-plugins instead of the expected “stuff/mu-plugins.” This departure from convention puzzled us as it conflicted with our expectations.
Attempts to resolve the issue with WP Engine support were met with limited success. Their response amounted to, “We don’t support custom directory structures. You can move them over, but you’ll need to manage them manually, and they might not function correctly.” While I had previously encountered challenges with custom directory structures on their platform, particularly with running WordPress within a subdirectory, the revelation that it extended to the wp-content directory posed a new dilemma. I faced the choice of either manually maintaining the WP Engine MU Plugins or abandoning the custom directory structure—neither option appealed to me.
Digging into how WordPress loads MU Plugins (wp-includes/load.php) revealed the existence of the WPMU_PLUGIN_DIR and WPMU_PLUGIN_URL constants, offering a potential solution. Defining these constants within wp-config.php to reflect the original wp-content/mu-plugins path seemed to resolve the issues. Now, with our content, plugins, and themes in “stuff,” MU Plugins are loading seamlessly from wp-content/mu-plugins as expected.
While I’ll keep an eye on any potential issues in the future, for now, it appears that this workaround could be the solution needed to navigate the complexities introduced by WP Engine’s directory structure. I’ll provide updates to this post if we encounter any challenges moving forward.