Connect to database using wordpress wp-config file

Using the defines the user sets in wp-config: mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); EDIT: Since your script is outside the WordPress environment, what you want to do is initiate it before using the defines in wp-config. require_once(‘./path/to/the/wp-config.php’); mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

Password in wp-config. Dangerous?

The “Hardening WordPress” page of the Codex contains a section on “Securing wp-config.php”. It includes changing the permissions to 440 or 400. You can also move the wp-config file one directory up from the root if your server configuration allows for that. Of course there is some danger to having a file with the password … Read more

Control verbosity level of WP DEBUG?

When WP_DEBUG is set, WordPress sets (via wp_debug_mode() call early in core load process) the error reporting level to E_ALL & ~E_DEPRECATED & ~E_STRICT. This means all warnings and errors except strict errors and PHP deprecated functions (not WordPress ones). You can define your own level in a custom mu-plugin (the override needs to be … Read more

What could a hacker do with my wp-config.php

localhost refers to the machine it’s running on. For example on my own site tomjn.com localhost is 127.0.0.1 as it always is. This doesn’t mean the hacker doesn’t know where to connect, it means the hacker replaces localhost with tomjn.com. Of course if I have a proxy sitting in front this won’t work, but keep … Read more