[wp-trac] [WordPress Trac] #29710: Add hooks to wpdb's insert(), update(), delete() and similar methods

WordPress Trac noreply at wordpress.org
Fri Sep 19 13:52:37 UTC 2014


#29710: Add hooks to wpdb's insert(), update(), delete() and similar methods
-------------------------+-----------------------------
 Reporter:  borekb       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 The `wpdb` class currently offers a `query` filter in its `query()` method
 which supplies ''unstructured'' data to its handlers (a string with an SQL
 query). In our plugin we need to work with ''structured'' data provided to
 the `insert()`, `update()` and similar methods. It would be great if these
 methods provided hooks both before and after the actual work happens.

 For instance, the `insert()` method would become:


 {{{
 function insert( $table, $data, $format = null ) {

     do_action( 'db_before_insert', $table, $data, $format );
     $result = $this->_insert_replace_helper( $table, $data, $format,
 'INSERT' );
     do_action( 'db_after_insert', $table, $data, $format, $result );

     return $result;
 }
 }}}

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


More information about the wp-trac mailing list