Loading wp-config.php in Main PluginFile

Crappy Code

Found this in a plugin submitted to WordPress.org/extend/plugins tonight:

require_once(dirname(__FILE__).'/../../../wp-config.php');

If you need to access information from wp-config.php, there are several ways to do it.

This is mostly bad for two reaons:

1. You are assuming the path to wp-config.php will never change (it can and will)

2. You are reloading a file that is already loaded

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s