Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#12811 closed feature request (worksforme)

DEFINE for location of wp-config.php

Reported by: erwinkerk Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: General Keywords: config
Focuses: Cc:


Currently, plugins have no way of finding out where the wp-config.php file resides. I suggest a DEFINE with the location of the config file.

Attachments (1)

patch.txt (708 bytes) - added by erwinkerk 11 years ago.

Download all attachments as: .zip

Change History (4)

11 years ago


#1 @Denis-de-Bernardy
11 years ago

  • Milestone Unassigned deleted
  • Resolution set to worksforme
  • Status changed from new to closed

the config is always in ABSPATH. it is the index.php file that occasionally is problematic, though you can always look up $_SERVER for that one.

#2 @TobiasBg
11 years ago

And just for curiosity: What is your plugin doing with the wp-config.php?

If you want to include it to get access to WP functions (i.e. for AJAX), be advised that this is not the correct way to do it. Instead please refer to the [ttp://codex.wordpress.org/AJAX_in_Plugins Codex] and to this blog-post.

#3 @nacin
11 years ago

I saw a brief conversation in the #wordpress-dev logs, so I wanted to address that.

For the extremely rare use case where a plugin needs to know where wp-config is, say a plugin that edits the file directly, I'd rather see them make the check themselves. (It's either ABSPATH or one level up.)

Providing a constant would only encourage plugins to incorrectly load wp-config.php instead of using the proper alternatives, such as admin-ajax.php.

Note: See TracTickets for help on using tickets.