Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#9009 closed defect (bug) (fixed)

delete_post_meta_by_key() fix

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by:
Milestone: 2.8 Priority: normal
Severity: major Version: 2.7
Component: Optimization Keywords: has-patch tested commit
Focuses: Cc:

Description

patch for the todo item is attached

Attachments (3)

9009-enhanced.diff (924 bytes) - added by Denis-de-Bernardy 15 years ago.
9009-enhanced-2.diff (1.4 KB) - added by Denis-de-Bernardy 15 years ago.
9009.diff (800 bytes) - added by Denis-de-Bernardy 15 years ago.
refreshed against 11255

Download all attachments as: .zip

Change History (12)

#1 @Denis-de-Bernardy
15 years ago

  • Keywords dev-feedback added

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.

#2 @Denis-de-Bernardy
15 years ago

Second enhanced version lets one use LIKE, NOT LIKE, REGEXP AND NOT REGEXP, as necessary.

#3 @Denis-de-Bernardy
15 years ago

  • Keywords tested added; dev-feedback removed

#4 @Denis-de-Bernardy
15 years ago

enhanced and enhanced2 diffs are bad ideas on second though. the first patch is the correct one to use.

#5 @Denis-de-Bernardy
15 years ago

  • Keywords commit added

#6 @Denis-de-Bernardy
15 years ago

  • Severity changed from normal to major

@Denis-de-Bernardy
15 years ago

refreshed against 11255

#7 @Denis-de-Bernardy
15 years ago

  • Component changed from General to Optimization

#8 @Denis-de-Bernardy
15 years ago

  • Summary changed from delete_post_meta_by_key() fix + enhancement to delete_post_meta_by_key() fix

#9 @ryan
15 years ago

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

(In [11305]) Clear cache after deleting meta. Props Denis-de-Bernardy. fixes #9009

Note: See TracTickets for help on using tickets.