Opened 13 months ago

Last modified 13 months ago

#20651 new enhancement

Inconsistent MS API: delete_site_option action hook is only called AFTER deletion, unlike delete_option

Reported by: danielnashnz Owned by:
Priority: normal Milestone: Awaiting Review
Component: Multisite Version: 3.3.2
Severity: normal Keywords: dev-feedback has-patch
Cc: xoodrew@…

Description

Unlike the delete_option action hook, the delete_site_option action hook is only called AFTER deletion of the row from the sitemeta table - making it difficult to capture the expiring value (for instance), unless you know its precise option key name ( and hook it using pre_delete_site_option_{$option} ).

Suggest introducing a pre-deletion, non-specific action hook call named "pre_delete_option" for options and "pre_delete_site_option" for site options, for consistency.

Attachments (2)

20651.diff (1.2 KB) - added by scribu 13 months ago.
20651.2.diff (1.2 KB) - added by SergeyBiryukov 13 months ago.

Download all attachments as: .zip

Change History (8)

  • Component changed from General to Multisite
  • Keywords dev-feedback added; delete_site_option MS removed
  • Keywords has-patch added

What a mess. 20651.diff:

  • add 'pre_delete_site_option' and call it only if the option exists
  • add 'pre_delete_option_{$option}'

Similar efforts: [13148]

To keep it consistent with delete_option and delete_site_option, shouldn't $option be passed as well in the do_action calls?

Obviously, 'pre_delete_site_option' is useless if we don't pass the $option. Sergey already submitted a fixed patch.

  • Cc xoodrew@… added
Note: See TracTickets for help on using tickets.