WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#12203 closed enhancement (wontfix)

Delete options with a wildcard

Reported by: technosailor Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: General Keywords:
Focuses: Cc:

Description

It would be nice to be able to say delete_option('foo_*') and WordPress respect that as a wildcard.

Just saying. :)

Attachments (2)

would_be_nice_to_have_a_wildcard.diff (913 bytes) - added by technosailor 6 years ago.
would_be_nice_to_have_a_wildcard-2.diff (663 bytes) - added by technosailor 6 years ago.
To avoid risk of someone pulling the proverbial rm -rf /, try patch 2 on for size.

Download all attachments as: .zip

Change History (5)

@technosailor6 years ago

To avoid risk of someone pulling the proverbial rm -rf /, try patch 2 on for size.

comment:1 @nacin6 years ago

The second patch is better but then it kind of highlights why this doesn't need to be in core. Aren't we encouraging option proliferation by giving plugin authors an API to remove in bulk all of their options that have a prefix? For the most part they should be using a single option (or two, if not all should be autoloaded).

I see a purpose here if you want to clear all transients, that's about it though. Can you share a use case?

comment:2 @technosailor6 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

Well, my use case is a database-based cache for a plugin. Using a single option or two, while preferred, is not conducive with the way the API I'm using is written (unfortunately). I see your point though and happy to close. I'll just take this bit and add it to my plugin.

Thanks

comment:3 @nacin5 years ago

  • Milestone 3.0 deleted
Note: See TracTickets for help on using tickets.