Opened 4 years ago
Closed 4 years ago
#9009 closed defect (bug) (fixed)
delete_post_meta_by_key() fix
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8 |
| Component: | Optimization | Version: | 2.7 |
| Severity: | major | Keywords: | has-patch tested commit |
| Cc: |
Description
patch for the todo item is attached
Attachments (3)
Change History (12)
Denis-de-Bernardy — 4 years ago
- Keywords dev-feedback added
Denis-de-Bernardy — 4 years ago
Second enhanced version lets one use LIKE, NOT LIKE, REGEXP AND NOT REGEXP, as necessary.
- Keywords tested added; dev-feedback removed
enhanced and enhanced2 diffs are bad ideas on second though. the first patch is the correct one to use.
- Keywords commit added
- Severity changed from normal to major
- Component changed from General to Optimization
- Summary changed from delete_post_meta_by_key() fix + enhancement to delete_post_meta_by_key() fix
Note: See
TracTickets for help on using
tickets.

The second patch is a suggested enhancement. It replaces the = operator with a LIKE operator, allowing to mass-delete post meta, like:
delete_post_meta_by_key('_plugin_cache_%')I needed this a couple of time in my own plugins and ended up using SQL to achieve it. Having it in the wp core would be a plus.