I am capturing a user's Work Anniversary and their content is being stored in an array. So the key as it relates to these Meta Fields is hire_date
and the value that is stored in that array looks something like this a:2:{s:3:"day";s:1:"8";s:5:"month";s:5:"March";}
What I don't really understand is how or what the 'orderby' => 'meta_value'
, is actually sorting by as the key has multiple values.
Right now if have the following code and I would like to know that the ASC order relates to the $current_day but I don't believe it is. I have tried using the 'type' => 'NUMERIC'
and the 'orderby' => 'meta_value_num'
but frankly I'm just not sure how to deal with this issue to display these work anniversary in ascending order in the month.
Thanks for any help solving this issue!
$current_month = date('F');
$current_day = date('d');
$args_anniversary_current = array(
'role__in' => array('subscriber', 'subscriberlimited'),
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_query' => array(
array(
'relation' => 'AND',
array(
'key' => 'hire_date',
'value' => $current_month,
'compare' => 'LIKE',
),
array(
'key' => 'hire_date',
'value' => $current_day,
'compare' => '>=',
),
),
),
);