0

I have a meta_query which works fine like:

$meta_query_args = array(
array(
    'key'     => 'price',
    'value'   => 145,
    'compare' => '='
)
);

I know this returns the post_id field(?)

How can I return a meta_value instead of a meta_key of the same post_id sa the meta query above.

Let's say the query above returned post_id 99, how can I get the meta_value of meta_key 'project' with the post_id 99. Can I combine it with the query I have above?

So instead of the query returning 99, it should return the meta_value instead

Thanks

2
  • Just to make answering clearer, what's happening with $meta_query_args? Are you putting it into WP_Query or get_posts()? Commented Jul 7, 2018 at 4:56
  • I'm putting it into WP_Query
    – Lhen
    Commented Jul 7, 2018 at 12:51

1 Answer 1

0
get_post_meta( int $post_id, string $key = '', bool $single = false )

Go through https://developer.wordpress.org/reference/functions/get_post_meta/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.