public function format_value( $value, $slug, $term_id ) {
		$meta_key = $this->get_setting( 'meta_key' );

		if ( empty( $meta_key ) ) {
			if ( is_numeric( $value ) && intval( $value ) !== 0 ) {
				$term_id = $value;
			}
		} else {
			$args = [
				'fields'     => 'ids',
				'meta_key'   => $meta_key,
				'meta_value' => $value,
				'hide_empty' => false,
				'taxonomy'   => $this->get_setting( 'taxonomy' ),
				'number'     => 1
			];

			$terms = get_terms( $args );

			if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
				$term_id = $terms[0];
			}
		}

		// Allow only id to be returned.
		if ( ! papi_is_admin() && $this->get_setting( 'fields' ) === 'ids' ) {
			$term = $this->get_term_value( $term_id );
		} elseif ( ! empty( $term_id ) ) {
			$term = get_term( $term_id );
		}

		if ( empty( $term ) || is_wp_error( $term ) ) {
			$term = $this->default_value;
		}

		return $term;
	}