How could one grab the post meta key of
_octopus_id and store that as an array.
Here is what I'm trying to achieve:
- Call the
WP_Queryand pull all the offices with
- Use the value of
_octopus_idand store it in an array
- End goal: Just print out a array with just the
Could someone tell me what I might be doing wrong? The
is_array($posts) prints out true, but I just can't figure out how to store the keys value there.
/* Set the WP offices in an array */ $ids = new WP_Query([ 'post_type' => 'office', 'post_status' => 'any', 'posts_per_page' => 10, 'meta_query' => array( array( 'key' => '_octopus_id', ), ) ]); $posts = $ids->posts; var_dump($posts); var_dump(is_array($posts));