how to get a file path of wp-config.php of wordpress site? -
i developing plugin in need include config , query wordpress database on click ..my question how url of wp-config.php dynamically ..i have used
include_once $_server['document_root'] . '/wp-config.php';
but getting error
include_once(): failed opening /wp-config.php' inclusion (include_path='.:/usr/share/php:/usr/share/pear')
and have tried many options
require_once('../../../wp-config.php'); require_once ("../wp-config.php");
i dunno wat exact path ..
any appreciated ..
in short, shouldn't trying include wp-config.php plugin. there few if reasons ever take approach. purists go far should never done.
a wordpress plugin has proper context access global $wpdb
variable querying. take @ example:
global $wpdb; $results = $wpdb->get_results( $wpdb->prepare("select * {$wpdb->prefix}your_table column = %s", $your_value) );
suggested reading:
Comments
Post a Comment