Automattic\WooCommerce\EmailEditor\Engine

Email_Api_Controller::get_personalization_tagspublicWC 1.0

Deprecated. It is no longer supported and may be removed in future releases. Use get_personalization_tags_collection instead.

Returns all registered personalization tags. We need to keep this endpoint for backward compatibility for older JS clients. We might consider removing it in the future (perhaps in late 2026).

Method of the class: Email_Api_Controller{}

No Hooks.

Returns

WP_REST_Response.

Usage

$Email_Api_Controller = new Email_Api_Controller();
$Email_Api_Controller->get_personalization_tags(): WP_REST_Response;

Changelog

Deprecated Use get_personalization_tags_collection instead.

Email_Api_Controller::get_personalization_tags() code WC 10.6.2

public function get_personalization_tags(): WP_REST_Response {
	$tags = $this->personalization_tags_registry->get_all();
	return new WP_REST_Response(
		array(
			'success' => true,
			'result'  => array_values(
				array_map(
					function ( Personalization_Tag $tag ) {
						return array(
							'name'          => $tag->get_name(),
							'token'         => $tag->get_token(),
							'category'      => $tag->get_category(),
							'attributes'    => $tag->get_attributes(),
							'valueToInsert' => $tag->get_value_to_insert(),
							'postTypes'     => $tag->get_post_types(),
						);
					},
					$tags
				),
			),
		),
		200
	);
}