- Article
- Intermediate
- 2 minutes read
- Reviewed August 4, 2026
- Advanced WordPress and integrations
WordPress provides several key-value APIs with different scopes and lifecycles.
Selecting the correct API improves clarity, caching, permissions and future migration.
Options API
Options store site-level settings.
Use them for configuration such as feature flags, API settings and plugin versions.
Avoid creating one autoloaded option for every record. Large or numerous autoloaded values can affect many requests.
In Multisite, network options represent network-level configuration, while normal options belong to the current site.
Transients API
Transients store temporary cached values with an expiration.
The expiration is a maximum lifetime. A transient can disappear earlier, especially when an external object cache evicts it.
Code must be able to regenerate the value after get_transient() returns false.
Do not use transients as the only store for data that cannot be recreated.
Metadata APIs
Metadata belongs to a WordPress object.
Core metadata types include:
- Post meta.
- user meta.
- term meta.
- comment meta.
- site meta in Multisite contexts.
Use registered metadata with schemas and authorization when it must appear through REST or blocks.
Choosing an API
Ask:
- Is the value configuration for the whole site?
- Does it belong to a specific object?
- Is it disposable cached data?
- Does it expire?
- Must it be queried at scale?
- Is the scope site or network?
- Who can read and change it?
- Does it require a custom relational model?
Serialization and Types
WordPress can serialize arrays and objects in option and metadata values.
Prefer simple, documented structures. Serialized blobs are difficult to query and migrate selectively.
Frequently Asked Questions
Can a transient be used as permanent storage?
No. It must be treated as disposable.
Should every plugin setting use a separate option?
Grouping can reduce rows, while separate options can improve targeted updates. Design according to size, autoloading and ownership.
Continue Learning
Previous: The WordPress Hook Lifecycle