Forums

Using $_SERVER[DOCUMENT_ROOT] in wp-config.php (1 post)

  1. Ivan
    Member
    Posted 7 months ago #

    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: http://codex.wordpress.org/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]

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 7 months ago by Ivan
  • This topic is not a support question
  • WordPress version: 3.2.1