I want to make json of my wordpress posts . When I do same for wp_users , it works but it does not work for wp_posts .It shows nothing in the browser.Here is my code:
<?php
$host="localhost";
$db_username="root";
$db_password="";
$db_name="test";
$conn=mysqli_connect($host,$db_username,$db_password,$db_name) or die('<h1 style="color:#ff0000;>Error
Connecting To Database !</h1>');
$sql="SELECT * FROM wp_posts;";
$result=mysqli_query($conn,$sql) or die('Error executing query .');
$arr=array();
while ($r=mysqli_fetch_assoc($result)) {
$arr[]=$r;
}
echo json_encode($arr);
?>