Automattic\WooCommerce\Internal\DataStores

CustomMetaDataStore::get_meta_keyspublicWC 8.8.0

Returns distinct meta keys in use.

Method of the class: CustomMetaDataStore{}

No Hooks.

Returns

String[].

Usage

$CustomMetaDataStore = new CustomMetaDataStore();
$CustomMetaDataStore->get_meta_keys( $limit ): array;
$limit(int)
Maximum number of meta keys to return.
Default: 100

Changelog

Since 8.8.0 Introduced.

CustomMetaDataStore::get_meta_keys() code WC 10.8.1

public function get_meta_keys( int $limit = 100 ): array {
	global $wpdb;

	return $wpdb->get_col(
		$wpdb->prepare(
			"SELECT DISTINCT meta_key FROM %i WHERE meta_key != '' AND meta_key NOT BETWEEN '_' AND '_z' AND meta_key NOT LIKE %s ORDER BY meta_key ASC LIMIT %d",
			$this->get_db_info()['table'],
			$wpdb->esc_like( '_' ) . '%',
			$limit
		)
	);
}