Printing out JSON array returned [closed]

Setting the proper dataType for the request is an important detail not considered in the answer above (this causes jQuery to send a HTTP Accept header with the request – and it will be expecting JSON data in the success callback as well): dataType: ‘json’, success:function(json){ var content=””; jQuery.each(json, function(i, v){ content += ‘<li>’ + … Read more

Accessing value from associative array

You’re doing one to many loops. What you want to be doing is this: $args = array( ‘child_of’ => $CurrentPage ); $children = get_pages( $args ); foreach ($children as $key => $value) { echo $key[‘post_title’]; }; Or you could also: $args = array( ‘child_of’ => $CurrentPage ); $children = get_pages( $args ); foreach ($children as … Read more

post custom values

Use var_dump($site[0]) to see the structure of the array. And once you know that, then you can properly reference an item in that array. (You could also do var_dump($site) to get a full picture of what’s going on.)

Get custom_user meta value and add entry

You need to pass get_user_meta a third parameter to prevent it from returning an array. That is where the mistake is, not with the add/update functions. $invoice_meta = get_user_meta( $_GET[‘id’], ‘invoices’, true); You will need to clean up any data already in the database or the existing nested arrays will still cause trouble.