When I ask for a post's meta value, it comes as an array or a string.
Can I store an array of values?
For example, if I have an array $postIDs=array(21,47,81,32)
, can I store it with update_post_meta($post_id, 'postIDs', $postIDs)
?
Currently, I'm joining the array into a string and storing that.
$postIDstring = implode(",", $postIDs);
update_post_meta($post_id, 'postIDs', $postIDstring);
Then I'm extracting it:$postIDstrings=update_post_meta($post_id, 'postIDs');
$postIDs=explode(",",$postIDstrings[0]);
How does it work?
- - , .
.
WordPress ...
ما را در سایت WordPress دنبال می کنید
برچسب : نویسنده : استخدام کار wpss بازدید : 240 تاريخ : يکشنبه 27 تير 1395 ساعت: 12:46