the_content()
echoes data to the page so essentially your query looks like:
'meta_query' => array(
array(
'key' => '',
'value' => $related_venue_variable,
'compare' => '=='
)
)
You want get_the_content()
to return a string that you can pass along through the query.
However, having the post content as a meta key doesn’t make any sense. For one, that key only holds 225 characters. Given that you may be storing the key from another post in the post content of a second post, that may not be a problem, but any filters applied on the post content will be as those can alter the content retrieved. In short, what you are doing is a bad, bad idea.
Now I’m guessing, but I think this is close to what you want to achieve:
if( have_posts() ) {
while( have_posts() ) {
the_post();
$args_up = array(
'post_type' => 'events',
'posts_per_page' => 20,
'paged' => $paged,
'meta_query' => array(
array(
'key' => $post->post_content,
'value' => $related_venue_variable,
'compare' => '=='
)
)
);
$eq = new WP_Query( $args_up );
}
}
But it’s still a bad idea to save a key as post content. You’d be better off saving it as custom meta in both posts. Of course, there might be a better way to do this all around if I knew exactly how it all went together.