Given an array of attributes, returns a string in the serialized attributes format prepared for post content.
Description
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. This function must produce output that remains in sync with the output of the serializeAttributes JavaScript function in the block editor in order to ensure consistent operation between PHP and JavaScript.
Parameters
$block_attributesarray
Attributes object.
Return
string
Serialized attributes.
Uses · 1
wp_json_encode()Encodes a variable into JSON, with some confidence checks.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/blocks.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.