mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-01 08:37:55 +02:00
a113f3da53
This changeset adds a new `rest_pre_insert_{$this->post_type}` filter in the `WP_REST_Templates_Controller`, where it is applied to the return value of the `prepare_item_for_database` method. (This is consistent with the `WP_REST_Post_Controller`, where that filter has existed before.) The new filter is then used to inject hooked blocks into the template (or template part) content received via the endpoint, prior to persisting it to the database. This supersedes the previous mechanism, which was using the `rest_after_insert_{$this->post_type}` ''action'', from which it performed an additional `wp_update_post` call to update the template (part) content with the hooked blocks injected. The new technique eschews that additional call and the resulting extra revision it created, as well as a problem with regard to duplicated escaping and sanitization, which had caused some special characters to be garbled. Reviewed by swissspidy. Merges [57790] to the to the 6.5 branch. Props tomjcafferkey, gziolo, swissspidy, karolmanijak. Fixes #60671. Built from https://develop.svn.wordpress.org/branches/6.5@57802 git-svn-id: http://core.svn.wordpress.org/branches/6.5@57303 1a063a9b-81f0-0310-95a4-ce76da25c4cd |
||
---|---|---|
.. | ||
endpoints | ||
fields | ||
search | ||
class-wp-rest-request.php | ||
class-wp-rest-response.php | ||
class-wp-rest-server.php |