get_post returns zero even posts are present in database

Here is my code it returns an empty results array

$txnid = ‘9504d29f624f0509d84e’;
$args = array(
‘meta_key’ => ‘_order_txnid’,
‘meta_value’ => $txnid,
‘post_type’ => ‘shop_order’,
‘post_status’ => ‘publish’
);

$results = get_posts( $args );
var_dump($results);

Read more here:: get_post returns zero even posts are present in database

Leave a Reply

Your email address will not be published. Required fields are marked *