WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

serialize_block_attributes() WP 5.3.1

Given an array of attributes, returns a string in the serialized attributes format prepared for post content.

The serialized result is a JSON-encoded string, with unicode escape sequence substitution for characters which might otherwise interfere with embedding the result in an HTML comment.

Хуков нет.

Возвращает

Строку. Serialized attributes.

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

serialize_block_attributes( $block_attributes );
$block_attributes(массив) (обязательный)
Attributes object.

Список изменений

С версии 5.3.1 Введена.

Код serialize_block_attributes() WP 5.5.3

<?php
function serialize_block_attributes( $block_attributes ) {
	$encoded_attributes = json_encode( $block_attributes );
	$encoded_attributes = preg_replace( '/--/', '\\u002d\\u002d', $encoded_attributes );
	$encoded_attributes = preg_replace( '/</', '\\u003c', $encoded_attributes );
	$encoded_attributes = preg_replace( '/>/', '\\u003e', $encoded_attributes );
	$encoded_attributes = preg_replace( '/&/', '\\u0026', $encoded_attributes );
	// Regex: /\\"/
	$encoded_attributes = preg_replace( '/\\\\"/', '\\u0022', $encoded_attributes );

	return $encoded_attributes;
}