WC_Data_Store_WP::get_db_info()
Table structure is slightly different between meta types, this function will return what we need to know.
Description Description
Return Return
(array) Array elements: table, object_id_field, meta_id_field
Source Source
File: includes/data-stores/class-wc-data-store-wp.php
protected function get_db_info() { global $wpdb; $meta_id_field = 'meta_id'; // for some reason users calls this umeta_id so we need to track this as well. $table = $wpdb->prefix; // If we are dealing with a type of metadata that is not a core type, the table should be prefixed. if ( ! in_array( $this->meta_type, array( 'post', 'user', 'comment', 'term' ), true ) ) { $table .= 'woocommerce_'; } $table .= $this->meta_type . 'meta'; $object_id_field = $this->meta_type . '_id'; // Figure out our field names. if ( 'user' === $this->meta_type ) { $meta_id_field = 'umeta_id'; $table = $wpdb->usermeta; } if ( ! empty( $this->object_id_field_for_meta ) ) { $object_id_field = $this->object_id_field_for_meta; } return array( 'table' => $table, 'object_id_field' => $object_id_field, 'meta_id_field' => $meta_id_field, ); }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |