Im trying to output or create json using wordpress posts data coupled with meta_key values.
This is the code I’m using, but its forming the JSON incorrectly.
$query = new WP_Query('cat=4&meta_key=meta_long');
echo "var json=". json_encode($query);
Any ideas of how to do this?
Try this: