Using $_SERVER[DOCUMENT_ROOT] in wp-config.php
-
I would like to share a word of caution about using $_SERVER[DOCUMENT_ROOT] in wp-config.php to point to the plugins directory location as described here: https://codex.www.ads-software.com/Editing_wp-config.php#Moving_wp-content
If your site is on a shared hosting, like GoDaddy for example, $_SERVER[DOCUMENT_ROOT] might have the path string different from what you get from dirname(__FILE__). Both paths are correct, just different because of the links and mounting options, and configs used on the hosting system.
In my case it did not affect the WordPress in general but caused the problem with contact-form-7 plug-in not being able to resolve the path to its components.
Using define(‘WP_PLUGIN_DIR’, dirname(__FILE__).’/content/plugins’); instead resolved the problem.I believe dirname(__FILE__) is the prefered method since ABSPATH is set the same way by WP.
[Moved to Requests & Feedback]
- The topic ‘Using $_SERVER[DOCUMENT_ROOT] in wp-config.php’ is closed to new replies.