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

WordPress Trac noreply at wordpress.org
Thu Jul 12 13:32:53 UTC 2018


#44042: Hook for ‘delete_option’ behaviour required
-------------------------------------------------+-------------------------
 Reporter:  RobertoDonPedro                      |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Options, Meta APIs                   |     Version:  1.2
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch dev-        |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by kkarpieszuk):

 @RobertoDonPedro in case it never is applied, you can use existing action
 to achieve what you want:
 - get option into a variable which you know will be deleted in the moment
 - modify it as you want
 - add new option from a modified variable, if name is the same, the best
 will be to add it again when it is actually deleted (in `deleted_option`
 action, you can store variable as static to pass between actions)

 So this is also a thing for code maintainers if it really must be merged
 into the code (still, it is better to add filter like this to modify
 option upfront than run additional SQL queries to delete and put option
 back in DB)

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


More information about the wp-trac mailing list