クラス wpdb::delete()
クラス wpdb::delete()
定義ファイル :/blog/wp-includes/wp-db.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | public function delete( $table, $where, $where_format = null ) { if ( ! is_array( $where ) ) return false; $wheres = array(); $where_formats = $where_format = (array) $where_format; foreach ( array_keys( $where ) as $field ) { if ( !empty( $where_format ) ) { $form = ( $form = array_shift( $where_formats ) ) ? $form : $where_format[0]; } elseif ( isset( $this->field_types[ $field ] ) ) { $form = $this->field_types[ $field ]; } else { $form = '%s'; } $wheres[] = "$field = $form"; } $sql = "DELETE FROM $table WHERE " . implode( ' AND ', $wheres ); return $this->query( $this->prepare( $sql, $where ) ); } |