Used By
Used By | Description |
---|---|
wp-includes/blocks.php: get_comment_delimited_block_content() | Returns the content of a block, including comment delimiters. |
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.
(array) (Required) Attributes object.
(string) Serialized attributes.
File: wp-includes/blocks.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; }
Version | Description |
---|---|
5.3.1 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/serialize_block_attributes