Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

basic meta query

$post_exist = array(
	array(
		'key'     => 'post_id',
		'value'   => '123456',
		'compare' => '=',
		'type'    => 'CHAR',
	),
);