WC_Data::is_internal_meta_key( string $key )
Check if the key is an internal one.
Description Description
Parameters Parameters
- $key
-
(Required) Key to check.
Return Return
(bool) true if it's an internal key, false otherwise
Source Source
File: includes/abstracts/abstract-wc-data.php
protected function is_internal_meta_key( $key ) {
$internal_meta_key = ! empty( $key ) && $this->data_store && in_array( $key, $this->data_store->get_internal_meta_keys(), true );
if ( ! $internal_meta_key ) {
return false;
}
$has_setter_or_getter = is_callable( array( $this, 'set_' . $key ) ) || is_callable( array( $this, 'get_' . $key ) );
if ( ! $has_setter_or_getter ) {
return false;
}
/* translators: %s: $key Key to check */
wc_doing_it_wrong( __FUNCTION__, sprintf( __( 'Generic add/update/get meta methods should not be used for internal meta data, including "%s". Use getters and setters.', 'woocommerce' ), $key ), '3.2.0' );
return true;
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.2.0 | Introduced. |