INVP::untranslate_custom_field_names( string $meta_key )

Removes the prefix from our post meta field keys so ‘inventory_presser_make’ becomes ‘make’. Careful to not damage any provided key that does not start with our prefix.


Parameters Parameters

$meta_key

(string) (Required) The prefixed meta key.


Top ↑

Return Return

(string) The un-prefixed meta key.


Top ↑

Source Source

File: includes/class-invp.php

	 * 'inventory_presser_make' becomes 'make'. Careful to not damage any
	 * provided key that does not start with our prefix.
	 *
	 * @param  string $meta_key The prefixed meta key.
	 * @return string The un-prefixed meta key.
	 */
	public static function untranslate_custom_field_names( $meta_key ) {
		if ( empty( $meta_key ) ) {
			return '';
		}
		$meta_key = strtolower( $meta_key );
		// prefix may start with an underscore because previous versions hid some meta keys.
		$prefix = ( '_' === $meta_key[0] ? '_' : '' ) . self::meta_prefix();

		// does $meta_key actually start with the $prefix?
		if ( substr( $meta_key, 0, strlen( $prefix ) ) === $prefix ) {