2

I ran a check on wp_options table and I found lots of unsolicited RSS content, which points to sites such as WordPress.org and WP Tavern.

This content is taking 75% of space in my database.

I am aware of a few SE questions about how to remove orphan transients that are not removed automatically, but I'd like to know if there is a way to prevent them from getting into my database in the first place.

A Google search does not help.

2
  • 1
    WP is supposed to clean these up automatically, this implies that your sites cron system stopped working, have you checked that this isn't broken? It sounds like you either have a very small database, or your site has been around for a long time and the regular processes meant to cleanup this data have been disabled for many many years.
    – Tom J Nowell
    Feb 4, 2023 at 20:25
  • 1
    as for prevention, those transients weren't always orphans, when you create a transient it's there and when it expires a piece of code is meant to go delete it and it has to be checked for, it can't just happen on its own without code checking. If nothing checks it never happens
    – Tom J Nowell
    Feb 4, 2023 at 20:26

1 Answer 1

3

but I'd like to know if there is a way to prevent them from getting into my database in the first place.

The only way to prevent expired transients ever being a thing is to never use them to begin with.

When you create a transient an option is created with a particular name. Eventually that transients expiration date comes and it needs cleaning up, this can be automated and WordPress does this automatically. Your situation happens because that automation is either disabled or unable to run.

Sadly, what you're asking for is the very thing you're trying to avoid, a clean up cron job of some sort.

As for RSS feeds, you wouldn't want this. Not caching the result would lead to major performance losses. HTTP requests are some of the slowest and most expensive things you can do in WordPress. This can also have significant knock on effects on popular plugins that fetch news and other RSS feeds, as well as RSS widgets and RSS blocks.


As an aside, if you have an object cache, WP will try to use it instead for transient storage, e.g. Redis or memcached. Redis/etc will auto-cleanup, and has its own expired garbage collection processes too. This becomes highly dependent on your server and software though, and you're essentially trading one set of problems for another. You should get a persistent object cache if you can, but because it's a big performance boost, not for transient cleanup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.