update_post_meta()
keeps adding to an array instead of replacing value. Any tips?
Previously I used add_post_meta()
by accident and perhaps that somehow flagged the field as an array?
Update
So how can I set a meta field to NOT be an array?
code:
$lowjobtrig = 1;
foreach ( $values as $value ) :
//====================myedit==================
if ($key == 'public_paywall') {
if ($value == 'paywall') {
add_post_meta($postId, $key, $value, /*unique=*/ false);
} elseif ($value == 'public'{
add_post_meta($postId, $key, $value, /*unique=*/ false);
}
} elseif ($key == 'pay_offer') {
if ($value == 'pay') {
add_post_meta($postId, $key, $value, false);
} elseif ($value == 'no pay') {
add_post_meta($postId, $key, $value, false);
} else {
}
} elseif ($key == 'low_jobs' AND $value == 'under 100'){
$lowjobtrig = 1;
update_post_meta($postId, $key, 'under 100');
} elseif ($key == 'low_jobs' AND $value != 'under 100' AND $lowjobtrig == 0){
add_post_meta($postId, $key, 'OVER 100', true);
$lowjobtrig = 1;
}
else {
FeedWordPress::diagnostic('syndicated_posts:meta_data', ">>>>>>>>>>ELSE Adding post meta-datum to post [$postId]: [$key] = ".MyPHP::val($value, /*no newlines=*/ true));
add_post_meta($postId, $key, $value, /*unique=*/ false);
}