Created
March 31, 2017 01:27
-
-
Save byteface/27b05db71559d8caa3ef679db95b5e4b to your computer and use it in GitHub Desktop.
get wordpress database as json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once('../../../../wp-load.php'); | |
private function get_store_data(){ | |
$mydb = new wpdb('DB_USER','DB_PASSWORD','DB_NAME','DB_HOST'); | |
$rows = $mydb->get_results("select * from some_wp_table"); | |
$data=wp_json_encode( $rows ); | |
return json_decode( $data, true ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment