[wp-trac] [WordPress Trac] #44042: Hook for ‘delete_option’ behaviour required

WordPress Trac noreply at wordpress.org
Fri May 11 07:45:45 UTC 2018

#44042: Hook for ‘delete_option’ behaviour required
 Reporter:  RobertoDonPedro  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
 Hi, I posted this  about one month ago in the wordpress support forum:

 I did not receive any answers there but referred to this forum, so I post
 it here again:\\

 Hi, I would need to prevent and change the deletion of certain options by
 the WP core function ‘delete_option’.
 There is a hook
 do_action( 'delete_option', $option );
  available here: [https://core.trac.wordpress.org/browser/tags/4.9.4/src
 But this does neither provide a way to exit the delete_option function
 before the option is deleted nor to change the option name to be deleted.
 In fact this existing hook seems to be pretty useless.
 Therefore I would need a filter in the first line of the delete_option
 core function like
 $option = apply_filters( 'delete_option_name', $option );
 Or change the line 535 from
 $option = trim( $option );
 $option = trim( apply_filters( 'delete_option_name', $option ));

 Any chances to get this into core immediately?\\

 Thx, Robert

Ticket URL: <https://core.trac.wordpress.org/ticket/44042>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list