Skip to content
rmccue edited this page Sep 8, 2014 · 2 revisions

Mercator must be loaded during sunrise.

We recommend dropping Mercator's directory into your mu-plugins directory, then creating a wp-content/sunrise.php file with the following:

<?php

require WPMU_PLUGIN_DIR . '/mercator/mercator.php';

Note that you'll also need sunrise enabled in your wp-config.php:

define( 'SUNRISE', true );

Why sunrise?

Mercator needs to load before WordPress loads the current site. MU plugins and network activated plugins load after this, as the latter relies on the site's network for obvious reasons.

WordPress includes a drop-in called sunrise.php that is specifically intended for this purpose. Mercator uses this functionality to load itself.

Note that unlike the MU Domain Mapping "plugin", you should not copy Mercator's code into your sunrise file. We want to keep Mercator separated, so it's simple for you to update. While this can have less flexibility than editing the mapping code, we include actions and filters to allow editing this much more easily.

Why mu-plugins?

Since Mercator loads during the sunrise period, it cannot be enabled or disabled for specific sites. Including Mercator in your plugins directory could be confusing because of this.

However, subdirectories of mu-plugins are not loaded automatically. This allows the Mercator directory to be placed into mu-plugins without affecting load, but also keeps your content directory nice and tidy. Pretty cool, eh?

P.S. Mercator does not require placing inside your mu-plugins directory. Anywhere inside your content directory is fine, as long as you adjust the path in your sunrise loader.

Clone this wiki locally