Installing Wordpress SEO (an a few others but not all plugins) gives the following console error:

GET http://craigmdennis.com/content/plugins/nfs/c08/h04/mnt/152547/domains/craigmdennis.com/html/content/plugins/wordpress-seo/js/wp-seo-admin-global.js?ver=1.2.5 404 (Not Found)

For some reason it is listing the complete server path after my url. It seems as though /nfs/c08/h04/mnt/152547/domains/craigmdennis.com/html/content/plugins/ or http://craigmdennis.com/content/plugins/ should not be present in the url.

Here is the directory structure (please note the custom content directory):


I am not running MU. I also have a subdomain for media (shouldn't be effecting the issue but I'm listing it for completedness)

Here are the relevant parts of my wp-config.php file:

define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp');

define('WP_HOME',    'http://' . $_SERVER['HTTP_HOST']);

define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/content');

define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/content');

Does anyone know what's going on here? Thanks.

[EDIT] I think it's related to __FILE__ and not DOCUMENT_ROOT as the plugins all use __FILE__ to get the directory name. This provides /nfs/c08/h04/mnt/ instead of /home/.

When I echo the location of the plugins_url() I get /home/152547/domains/dev.craigmdennis.com/html/content/plugins which is correct but when I pass in FILE as a parameter I get the aforementioned /nfs/c08/h04/mnt/152547/domains/dev.craigmdennis.com/html/content/plugins/{plugin-folder}.

Could this be something to do with PHP resolving aliases for __FILE__ This would explain why it works on my local server (with no aliases) and doesn't on Media Temple (which may alias /nfs/c08/h04/mnt/ for /home/ Is this a Wordpress issue or an issue on my server?

  • We'll need to see more code here. Can include the bits specifically regarding the JS enqueue? Commented Jul 23, 2012 at 1:59
  • Based on @kalengi Answer, what if you also define WP_PLUGIN_*?
    – brasofilo
    Commented Jul 23, 2012 at 12:28
  • Can you be more specific? Do you mean the enqueue in my theme's functions.php of the enqueue used within the affected plugins?
    – Craig
    Commented Jul 23, 2012 at 12:30
  • @brasofilo I have tried explicitly defining WP_PLUGIN_DIR but have only just noticed WP_PLUGIN_URL can also be defined. I will try these again.
    – Craig
    Commented Jul 23, 2012 at 12:33
  • This Q&A may be useful: wordpress.stackexchange.com/q/1507/12615
    – brasofilo
    Commented Jul 23, 2012 at 13:12

3 Answers 3


Given that the js location is determined as follows:

$js_location = WPSEO_URL . 'js/wp-seo-admin-global.js'



I suspect the problem lies with the derivation of <WP_SEO_PLUGIN_PATH>. This value is determined by the code in the function plugins_url() found in wp-includes\link-template.php

If you debug that function, it may yield the reason why <WP_SEO_PLUGIN_PATH> is producing the wrong value: 'nfs/c08/h04/mnt/152547/domains/craigmdennis.com/html/content/plugins/wordpress-seo'

  • I doubt it is anything to do with the Wordpress core files or the plugin as it works fine locally. I think it is a server configuration issue or incorrect file path somewhere.
    – Craig
    Commented Jul 23, 2012 at 21:42

The error is the result of the php __FILE__ resolving any aliases or symlinks on the server.

The solution is to set define('WP_CONTENT_DIR', dirname(__FILE__) . '/content'); so it is also the absolute file path on the server after resolving aliases.

See: http://php.net/manual/en/language.constants.predefined.php#104842


Taking the example of Craig's solution, I've found a solution:

Craig posted this link that gives me some light about it:

See: http://php.net/manual/en/language.constants.predefined.php#104842

Using the WP_PLGUIN_DIR global using my external plugin folder solved the issue.

I've declared this on my wp-config.php

define( 'WP_PLUGIN_DIR', '/var/www/name-of-the-external-folder/plugins' );

Hope it helps anyone here, It took me a while to discover.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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