Querying meta queries

When working with queries for custom post types, you need to specify what the post status is otherwise it will default to look for `published`.

<?php

$query = new WP_Query([
    'post_type' => 'form_data',
    'post_status' => 'any',
    'meta_query' => [
       [
           'key' => 'email',
           'value' => $email
       ]
    ],
]);

Leave A Comment

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