I have two CPTs that are related via a meta value on one of them. I have a meta_key in one CPT that holds the ID of its linked other CPT.
If I go to that post in the admin and dump its meta like this,
$meta = get_post_meta( $_GET['post'] ); dd( $meta );
It then dumps out an array as I would expect, matching what is in DB,
Array ( ..... [practice_id] => Array (  => 4519 ) ..... )
So I then run my query for posts on the other CPT edit screen and dump results,
$current_practice_id = $_GET['post']; $practice_args = array( 'post_type' => 'sf-location', 'meta_query' => array( array( 'key' => 'practice_id', 'value' => $current_practice_id, ), ), ); $practice_array = get_posts( $practice_args ); dd($practice_args);
And it just returns an empty array.
$current_practice_id is getting set to the proper Post ID, in this case, 4519.
So it should be returning the post seen in the first screenshot, Post ID 4520 in this case.
What am I missing here?