WC_Tracks_Event::build_pixel_url()publicWC 1.0

Build a pixel URL that will send a Tracks event when fired. On error, returns an empty string ('').

Метод класса: WC_Tracks_Event{}

Хуков нет.

Возвращает

Строку. A pixel URL or empty string ('') if there were invalid args.

Использование

$WC_Tracks_Event = new WC_Tracks_Event();
$WC_Tracks_Event->build_pixel_url();

Код WC_Tracks_Event::build_pixel_url() WC 8.7.0

public function build_pixel_url() {
	if ( $this->error ) {
		return '';
	}

	$args = get_object_vars( $this );

	// Request Timestamp and URL Terminator must be added just before the HTTP request or not at all.
	unset( $args['_rt'], $args['_'] );

	$validated = self::validate_and_sanitize( $args );

	if ( is_wp_error( $validated ) ) {
		return '';
	}

	return esc_url_raw( WC_Tracks_Client::PIXEL . '?' . http_build_query( $validated ) );
}