0

I am facing issues saving large amount of data in post meta field e.g. I have created a field Bio/description and put a huge amount of text in it. Now when I save it, it saves some of the text and sometimes nothing saved in the meta field. I have searched through web but didn't get the clear answer. So I want to know what is the size/length restriction on postmeta fields to accept the text?

Is there any way we can fix this issue or it will be better to save data in custom table where we can use Long text field which will definitely save it. Also want to know how saving huge amount of data in post meta field will effect the site performance?

Thanks in advance!

  • Please read your question and ask yourself if you would have been able to understand it if you didn't write it. – Mark Kaplun Apr 27 '16 at 9:19
  • Sorry, I have edited the questions to make it more clear. But I think it is not that hard to understand :-) – TBI Infotech Apr 27 '16 at 11:24
  • :( If I ask you literally "some times my code has a bug, is it possible to fix?" what is the chance you will be able to find or help me find the bug? All the information you have given is that you try to save user meta and it fails, no code, no wordpress verion, no if you tried to disable all plugin, no info at all :( – Mark Kaplun Apr 27 '16 at 12:41
  • I don't want you to look into my code. If you can read carefully, my only question is that " Is there any restriction on size/length of post meta field to accept the text."? And if yes, what could be the possible solutions :-) – TBI Infotech Apr 27 '16 at 14:44
  • if that is your question, then please edit it to say so. and the answer is no – Mark Kaplun Apr 27 '16 at 14:53
1

The meta_value field is longtext, which a quick google reports is 4,294,967,295 characters - I doubt you're exceeding that.

Chances are it's an issue with PHP, specifically post_max_size - if this is less than the "huge amount of data" you are referring to, PHP will simply truncate $_POST and you end up with nothing.

  • Thanks, that is helpful. Also what would be good in terms of site performance, saving it in post meta or custom table with this huge data. – TBI Infotech Apr 29 '16 at 7:03
  • Possibly - if these posts are in a loop and you start playing with metadata, WordPress is going to load all of it into memory, which might quickly get out of hand. – TheDeadMedic Apr 29 '16 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.