I’m not sure you understand the logic of WP_Query
. Rather than explain in words, here’s a code example;
$query = new WP_Query( array( 'meta_key' => 'Old ID', 'meta_value' => $atts['oldid'] ) );
if ( $query->have_posts() )
return $query->posts[0]->post_title;
return '';
Check out the codex on interacting with WP_Query.
UPDATE: To use the query as you would normally, i.e. The Loop;
<?php if ( $query->have_posts() ) : ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<a href="https://wordpress.stackexchange.com/questions/16600/<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata(); ?>