WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#37929 new enhancement

Add `pre_delete_option` filter

Reported by: flixos90 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: has-patch
Focuses: Cc:
PR Number:

Description

get_option() and update_option() already have filters to short-circuit their respective processes, so I think a similar filter should be added to delete_option() as well.

Related: #37928

Attachments (2)

37929.diff (1.3 KB) - added by flixos90 3 years ago.
37929.2.diff (926 bytes) - added by flixos90 3 years ago.

Download all attachments as: .zip

Change History (7)

@flixos90
3 years ago

#1 @flixos90
3 years ago

  • Keywords has-patch added; needs-patch removed

37929.diff is a first take on introducing the filter.

#2 @OriginalEXE
3 years ago

Interesting idea.

In your patch, maybe you should use

! is_null( $skip )

instead of

null !== $skip

to keep it consistent with the null check immediately below.

Last edited 3 years ago by OriginalEXE (previous) (diff)

@flixos90
3 years ago

#3 @flixos90
3 years ago

37929.2.diff is an updated patch that gives parity with the latest patch on #37928.

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


3 years ago

Note: See TracTickets for help on using tickets.