Black Friday - Cyber Monday Sale
30% OFF All Premium Licenses
  • 00 Days
  • 00 Hrs
  • 00 Mins
  • 00 Secs
Use code
SIGMA30

This 30% discount applies only to the first year. From the second year, renewals are charged at the regular price.

What are oEmbed caches and how to clean them?

Younes JFR.

What are oEmbed caches?

When you embed external media like YouTube videos, tweets, or Instagram posts in WordPress, the platform creates cached data called oEmbed caches to load these embeds faster. These cached responses are stored as post metadata in the wp_postmeta table using keys like _oembed_* and _oembed_time_*.

How they affect your database?

Over time, these oEmbed cache entries accumulate, especially on websites that frequently embed external content. Although they improve load times initially, they can become outdated or useless when embedded content changes or posts are deleted. This results in unnecessary entries in the wp_postmeta table, making it heavier and slower.

How to clean them?

1. Using Advanced Database Cleaner plugin

You can safely delete oEmbed cache data using the General Cleanup module in Advanced Database Cleaner plugin.

The plugin automatically detects and removes oEmbed cache entries, allowing you to:

  • Delete all oEmbed cache entries from your database.
  • Schedule automated cleanups to keep the database optimized over time.

2. Using a raw SQL query

If you prefer manual cleanup, you can run the following SQL query in phpMyAdmin for example:

DELETE FROM wp_postmeta 
WHERE meta_key LIKE '_oembed_%';

In multisite environments, this query must be run for each subsite, replacing wp_ with the corresponding subsite table prefix (for example, wp_2_, wp_3_, etc.).

Note:
While you can manually run these SQL commands to clean oEmbed caches, we strongly recommend using the Advanced Database Cleaner plugin.
It uses WordPress’s internal cleaning methods, automatically handles multisite installations, and ensures that all related data is safely removed while keeping your database consistent and stable.