Steven Hardy
Steven Hardy

Reputation: 79

Return Post ID from WP_Meta_query

I am looking to get the post_id column after running this code:

$query_args = array (
        array(
            'key' => 'registration',
            'value' => $reg,
            'compare' => '='
        )
    );

    $query = new WP_Meta_Query($query_args);

How can I retrieve the post_id for the post please?

Upvotes: 0

Views: 108

Answers (1)

Ηρακλής Β.
Ηρακλής Β.

Reputation: 84

You can use get_the_ID() like this:

$post_id = get_the_ID();

Upvotes: 1

Related Questions