Options Size Limit (1MB)

WordPress.com VIP platform specific

This document is for sites running on WordPress.com VIP.

Learn more

On WordPress.com, options are cached in memory to avoid database lookups, which speed things up. This is only effective if the cached object is kept small. Once the object reaches a certain limit (1MB) it will no longer cache and requests are sent to the database servers, which, depending on the traffic of the site, can cause a flood of requests and have a severe impact on performance. This 1MB limit is the total limit of all options in the options table. This behaviour is different from the core WordPress implementation, having autoload set to false will not impact this 1MB limitation. We recommend using the WP Large Options plugin for persistent data that may grow larger than 1MB.

Here are several guidelines you should keep in mind when working with options as storage containers.

  • Be sure the sum of all data you store in options (get_option(), etc.) is less than 400 KB at most. Options are meant for settings and plugin options. If you need to store bigger HTML fragments, consider using a custom post type or the wp-large-options plugin.
  • Each WP_Cache object can be no larger than 1MB or it will fail to cache. Where applicable and necessary, store items in individual cache objects rather than a single large cache object in order to avoid potentially hitting the limit.
  • Always store only what is really necessary in options. For example: If you need only the post_id, title or link of a post, don’t store the full post object.
  • Make sure your data is sanitized and validated.
  • Check that the data is not escaped twice. Double escaping data, especially if it is automatically filled, can cause the values to grow out of control.
  • Never write options from the front-end. Write operations caused by front-end functionality are generally a bad idea and will slow down your site.

Ready to get started?

Drop us a note.

No matter where you are in the planning process, we’re happy to help, and we’re actual humans here on the other side of the form. 👋 We’re here to discuss your challenges and plans, evaluate your existing resources or a potential partner, or even make some initial recommendations. And, of course, we’re here to help any time you’re in the market for some robust WordPress awesomeness.