i have an meta_key 'reviewer_for_post' which includes 'reviewer_id' as an array key but how can i get it's value inside meta_query Here what i want to do
'meta_query' => array(
array(
'key' => 'reviewer_for_post[reviewer_id]',
'value' => $user_editor->ID,
'compare' => '='
),
),
i want to compare [reviewer_id](which is inside 'reviewer_for_post' key) value with $user_editor->ID value
$user_editor->IDwas5, you are trying to look for posts that have the keyreviewer_for_post[5]set, is that what you mean? Then insert the user id into the key, removevalue, and useEXISTSas the comparison operator.reviewer_for_post[reviewer_id], but justreviewer_for_post. The value appears to be an array stored in PHP'sserializeformat (although the given example seems to be missing something, can't be unserialized.) There is no direct way to search for specific "entries" within this text value - you will have to use the LIKE operator, and search for values that contain%s:11:"reviewer_id";s:2:"56"%In place of the56you will have to insert your reviewer ID, and the 2 ins:2before that needs to be replaced with the number of digits the ID has.