src/core/class-papi-core-data.php
public function update( $id, $slug, $value ) {
		$save_value = true;

		// Get right update function to use.
		$fn = $this->get_function( 'update' );

		if ( ! is_callable( $fn ) ) {
			return false;
		}

		// Check for string keys in the array if any.
		foreach ( array_keys( papi_to_array( $value ) ) as $key ) {
			if ( is_string( $key ) ) {
				$save_value = false;
				break;
			}
		}

		// If main value shouldn't be saved it should be array.
		if ( ! $save_value && is_array( $value ) ) {
			$value = [$value];
		}

		// Delete saved value if empty.
		if ( papi_is_empty( $value ) ) {
			return $this->delete( $id, $slug );
		}

		$result = true;

		foreach ( papi_to_array( $value ) as $key => $val ) {
			// Delete saved value if value is empty.
			if ( papi_is_empty( $val ) || $val === '[]' || $val === '{}' ) {
				return $this->delete( $id, $slug );
			}

			// Delete main value cache.
			papi_cache_delete( $slug, $id, $this->type );

			// If not a array we can save the value.
			if ( ! is_array( $val ) ) {
				if ( $save_value ) {
					$val = $value;
				}

				if ( $this->id ) {
					$out    = call_user_func_array( $fn, [$this->type, $id, unpapify( $slug ), $val] );
					$result = $out ? $result : $out;
				} else {
					$out    = call_user_func_array( $fn, [unpapify( $slug ), $val] );
					$result = $out ? $result : $out;
				}

				continue;
			}

			// Clear cache for all child values.
			$this->update_clear_cache( $id, $value );

			// Update metadata or option value for all child values.
			foreach ( $val as $child_key => $child_value ) {
				if ( papi_is_empty( $child_value ) ) {
					$this->delete( $id, $child_key );
				} else {
					if ( $this->id ) {
						call_user_func_array( $fn, [$this->type, $id, unpapify( $child_key ), $child_value] );
					} else {
						call_user_func_array( $fn, [unpapify( $child_key ), $child_value] );
					}
				}
			}
		}

		return $result;
	}
public function update( $id, $slug, $value ) {
		$save_value = true;

		// Get right update function to use.
		$fn = $this->get_function( 'update' );

		if ( ! is_callable( $fn ) ) {
			return false;
		}

		// Check for string keys in the array if any.
		foreach ( array_keys( papi_to_array( $value ) ) as $key ) {
			if ( is_string( $key ) ) {
				$save_value = false;
				break;
			}
		}

		// If main value shouldn't be saved it should be array.
		if ( ! $save_value && is_array( $value ) ) {
			$value = [$value];
		}

		// Delete saved value if empty.
		if ( papi_is_empty( $value ) ) {
			return $this->delete( $id, $slug );
		}

		$result = true;

		foreach ( papi_to_array( $value ) as $key => $val ) {
			// Delete saved value if value is empty.
			if ( papi_is_empty( $val ) || $val === '[]' || $val === '{}' ) {
				return $this->delete( $id, $slug );
			}

			// Delete main value cache.
			papi_cache_delete( $slug, $id, $this->type );

			// If not a array we can save the value.
			if ( ! is_array( $val ) ) {
				if ( $save_value ) {
					$val = $value;
				}

				if ( $this->id ) {
					$out    = call_user_func_array( $fn, [$this->type, $id, unpapify( $slug ), $val] );
					$result = $out ? $result : $out;
				} else {
					$out    = call_user_func_array( $fn, [unpapify( $slug ), $val] );
					$result = $out ? $result : $out;
				}

				continue;
			}

			// Clear cache for all child values.
			$this->update_clear_cache( $id, $value );

			// Update metadata or option value for all child values.
			foreach ( $val as $child_key => $child_value ) {
				if ( papi_is_empty( $child_value ) ) {
					$this->delete( $id, $child_key );
				} else {
					if ( $this->id ) {
						call_user_func_array( $fn, [$this->type, $id, unpapify( $child_key ), $child_value] );
					} else {
						call_user_func_array( $fn, [unpapify( $child_key ), $child_value] );
					}
				}
			}
		}

		return $result;
	}
Update property meta.

@param  int    $id
@param  string $slug
@param  mixed  $value

@return bool