admin管理员组

文章数量:1194970

I'm using the custom field to save some text and a few times my post didn't save. I don't know what happened. But I'm wondering if there is a size limit to that field.

var customFields = new Object();
var someValue = Request["Summary"];
customField["summary"] = someValue;
post.insertCustomField(customField);

I don't get any errors, or maybe I do but it doesn't happen every time so one guess is a size limit. Any help will be appreciated.

Also, I read somewhere that custom fields are stored as JSON strings so maybe large values are taking too much time to convert? I don't know. What do you want from me? Any help would be appreciated.

Update:
It seems that maybe there is a limit of 1MB or 2MB total applied somewhere along the way. I haven’t been able to test it since posting this question.

I'm using the custom field to save some text and a few times my post didn't save. I don't know what happened. But I'm wondering if there is a size limit to that field.

var customFields = new Object();
var someValue = Request["Summary"];
customField["summary"] = someValue;
post.insertCustomField(customField);

I don't get any errors, or maybe I do but it doesn't happen every time so one guess is a size limit. Any help will be appreciated.

Also, I read somewhere that custom fields are stored as JSON strings so maybe large values are taking too much time to convert? I don't know. What do you want from me? Any help would be appreciated.

Update:
It seems that maybe there is a limit of 1MB or 2MB total applied somewhere along the way. I haven’t been able to test it since posting this question.

Share Improve this question edited Jul 11, 2022 at 11:23 1.21 gigawatts asked May 21, 2018 at 18:36 1.21 gigawatts1.21 gigawatts 1,0003 gold badges13 silver badges34 bronze badges 4
  • 1 Custom fields, or more specifically "post meta" is stored in the postmeta table, in the meta_value column which is normally specified as LONGTEXT which amounts to a storage capacity of roughly 4 GB. – Nathan Powell Commented May 21, 2018 at 21:16
  • 1 They are not stored as JSON strings. – Nathan Powell Commented May 21, 2018 at 21:16
  • i also have this problem now~ Thanks for your answer~ – sunray sunray Commented Jul 11, 2022 at 9:16
  • @sunraysunray can you be more specific? The OP shared code that doesn't map on to any known WordPress functions and looks like javascript code, so it doesn't make a lot of sense. Are you sure it's the same issue? – Tom J Nowell Commented Jul 11, 2022 at 13:46
Add a comment  | 

1 Answer 1

Reset to default 1

Is there a size limit to the value you can save in a custom field?

Not specifically, as Nathan says:

Custom fields, or more specifically "post meta" is stored in the postmeta table, in the meta_value column which is normally specified as LONGTEXT which amounts to a storage capacity of roughly 4 GB.

So it's highly unlikely you've hit a size limit. You're more likely to run into network transfer timeouts transferring data or running out of memory before you're able to hit storage capacity limits.

What's more likely is that you're using an unnamed plugin/theme/framework and having issues there that are unrelated to your question about post meta maximum size. I say this because you shared code that is not using a WordPress API written in javascript:

var customFields = new Object();
var someValue = Request["Summary"];
customField["summary"] = someValue;
post.insertCustomField(customField);

To solve your problem you should ask about it in the respective theme/plugin/frameworks support routes, but rest assured it has nothing to do with how large a post meta/custom fields value can be in the database

本文标签: Is there a size limit to the value you can save in a custom field