WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

[this is not a Multisite question]

Update: this question is a logical impossibility, or a mind loop if you will, check update bellow.

The technique is laid out here in WPEngineer.
It allows having a single plugins folder to serve many WordPress sites running in the same server.

So, all my development sites have this in wp-config.php

define( 'WP_PLUGIN_DIR', '/www_dev/base-site/wp-content/plugins' );
define( 'WP_PLUGIN_URL', 'http://base-site.dev/wp-content/plugins');

Only the base-site has a plugins folder and don't have this constants set in its wp-config.

I found a situation where I am in other-site.dev and the plugin tries to call base-site.dev, as follows:

  • the plugin in question is Advanced Custom Fields, but I guess it can happen in any other
  • the Export XML function of the plugin calls this address http://base-site.dev/wp-content/plugins/advanced-custom-fields/core/actions/export.php
  • in theory, it should be http://other-site.dev/wp-content/plugins/advanced-custom-fields/core/actions/export.php, but this address doesn't exist

The plugin builds the form action that executes the export function using this variable $this->dir = plugins_url('',__FILE__);

The question is: could we make an htaccess rule or apply a filter to overcome this issue?


After anmari input and taking a closer look, I think there's no solution for this.
The plugins_url uses WP_PLUGIN_URL.

The plugin is rendering the following html:
<form action="http://base-site.dev/wp-content/plugins/advanced-custom-fields/core/actions/export.php" method="post">

and there is no, and never will be, anything like:
<form action="http://other-site.dev/wp-content/plugins/advanced-custom-fields/core/actions/export.php" method="post">

share|improve this question
up vote 1 down vote accepted

I guess what you are saying is that it then 'exports' the wrong system's xml (I'm not familiar with the plugin) ?

Ideally the plugin itself should be including/using the code rather in such a way so that it still knows the context/system in which it is being used irrespective of where the code is stored.

Have you tried seeing if the plugin author can update the plugin code rather ? Or perhaps getting someone to look at the code and offer a fix for it.

That would be a better solution rather than messing with htaccess.

share|improve this answer
Thanks for your kindly input, anmari. I've updated my question, but I think the essence is: no, this will never work. Cheers and thanks again for dropping by :) – brasofilo May 18 '12 at 10:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.