php - Add Values to Existing Wordpress User Meta Data -


i using simplexml_load_file bring data wordpress , add data user_meta_data.

i understand can pass array of meta key values @ time creating or updating meta data when run page again, new xml data, overwrites existing data.

what want happen add value same meta key. in different instance (when script runs again). here doing.

the reason 2 update_user_meta creating 1 meta key called "inbox-items" contains id's incoming email messages. second, creates new meta key id contains details of message (date, msg, from, etc...)

                  $msg_array = array (                                 'msg-date' => $msg_date,                                 'msg-details' => $msg_msg,                                 'msg-id' => $msg_msgid,                                 'msg-keyword' => $msg_keyword,                                 'msg-from' => $msg_from                                 );      update_user_meta($keyword_wpid,'inbox-items',(string) $inbox->incomingmessage->transactionid); update_user_meta($keyword_wpid,(string) $inbox->incomingmessage->transactionid, $msg_array); $get_inboxid = get_user_meta($keyword_wpid,'inbox-items', false);       foreach ($get_inboxid $i) {                 $get_msgs = get_user_meta($keyword_wpid,$i, false);                  echo '<br/><br/>';                 echo print_r($get_msgs);                 } 

you should using add_user_meta, not update_user_meta. add_user_meta keep old values , append new one.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -