Options Size Limit (1MB)

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?

Tell us about your needs

Let us lead the way. We’ll help you select a top tier development partner. We’ll train your developers, operations, infrastructure, and editorial teams. We’ll coarchitect your deployment processes. We will provide live support for peak events. We’ll help your people avoid dark alleys and blind corners, and reduce wasted cycles.