Is there a limit to the number of options you can store in one settings field of wp_options?

I have a theme with an options page. And on that page there are 1083 options. I’ve noticed that the last 13 are not saving. They were saving at one point, but after I added new options above them, they stopped working.

I suspected that I may have run up against some kind of option limit or limit on the array so to test that, I removed 7 options above the last 13 and sure enough 7 of them saved after that.

I’ve been trying to find information about this but have been unable to do so. Does anyone know if you can only have 1070 options in one settings field? It’s not an issue with the database longtext memory limit. These are simple 1’s and 0’s and hex color values and other CSS type stuff. The export of the field is only 33k.

1 Answer
1

The limit is probably not WordPress specific, but caused by PHP.

max_input_vars might be set to 1000, so not all fields might reach WordPress.

You can store 4,294,967,295 or 4GB (232 – 1) characters in one option, so I don’t think this is your problem. If it is, you should consider a separate table.

Leave a Comment