update_user_meta: How many is too many?

To answer your questions: Would these high number of calls to update_user_meta cause any performance degradation? The Higher the number of calls to the database the slower its going to work since every query takes some (not much but still) time. Which of the two appears to be a better solution? Recently I finished a … Read more

Custom fields PHP foreach loop

Something like this: $ck = get_post_custom_keys($post_id); //Array // drop keys starting with ‘_’ $ck = array_filter($ck, function($key){ return strpos($key, ‘_’) !== 0; }); // store your root keys here $data = array(); foreach($ck as $k){ $cv = get_post_custom_values($k, $post_id ); //Array // drop empty values $cv = array_filter($cv); if($cv) $data[$k] = $cv; } if($data){ // … Read more

How to use custom fields in post title?

What you’re looking for are the filters that let you modify the page title. There is a new way of doing this since WordPress 4.4, so I’m going to focus on that. If you happen to be using a version prior to 4.4 and you can’t update, the alternative is the wp_title filter (not to … Read more

With WordPress Importer, why can’t I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?

I would wage that your issue is with \r\n (CRLF). If the newlines are created in Windows, they’ll go into the database as \r\n and when serialized get counted as 2 characters. Then when importing, they’ll only be counted as 1 character and they’ll corrupt the string. I tested this hypothesis and sure enough I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)