plugin development – How to get all post_id and meta_value using meta_key in wp_postmeta table

Question

The wp_postmeta table has the following columns:

meta_id, post_id, meta_key, meta_value

I insert post id, meta key and meta_value like:

$arrg = array(
    'require_login' => 'Yes',
    'restrict_by'   => 'admin',
    'access_method' => 0
);
update_post_meta( $post_id, 'restriction_settings', $arrg );

Now I want to get post_id and meta_value using meta_key. get_post_meta() function is not working here because post_id is required here. Is it possible to get all post_id and meta_value using meta_key?

0
Md. Mehedi Hassan 1 week 2022-09-21T02:56:02-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse