Import integer as integer
-
Hello, am I missing something obvious? When importing meta key with integer value, it is imported as a string, e. g. 1234 as [“1234″] or ‘a:1:{i:0;s:4:”5919”;}’ (as shown in phpmyadmin). Is there any easy way to import integer numbers as numbers? Thank you!
-
This is always managed as a string because in CSV we read strings.
Anyway, update_user_meta, for example, does not manage the data as integer, so where have you seen some WP managing some meta data as integer?
Sorry, I wrote a nonsense 🙂
Value “1234” from the CSV is imported as an array – [“1234″] in the meta field or ‘a:1:{i:0;s:4:”1234”;} in the database. The target fields are of type “text”. Fields of type “boolean” are correctly imported (value “1” as true).Could you show me how are you importing this value in your CSV?
Sure! I tried this:
“ID”
1234and
“ID”
“1234”with the same result – meta text field “ID” in user profile containing [“1234”].
Thanks!
Yes, sure, but this is how WordPress save the data into meta.
Meta can be array or object, so it always save it in this way.
Which is the problem :s?
So – if I understand it correct – there is no straightforward way how to save the number as a pure string to the meta field using your plugin. I will solve it other way. Thank you for great support, marking as solved.
No this is not a problem of this plugin, this is a problem of how WordPress works: https://developer.ww.wp.xz.cn/reference/functions/update_user_meta/ check this function.
Thanks!
The topic ‘Import integer as integer’ is closed to new replies.