Bernhard Reiter
4cecd0e731
Block Hooks: Don't erase post content if it isn't changed by client.
...
The `inject_ignored_hooked_blocks_metadata_attributes` filter that is attached to both the `rest_pre_insert_wp_template` and `rest_pre_insert_wp_template_part` hooks receives a `stdClass` object from the Templates REST API controller that contains all fields that the client would like to modify when making a `POST` request (plus the `id` to identify the relevant template or template part, respectively).
There are cases when the `post_content` field is not set, e.g. when the client would like to rename an existing template (in which case it would only set the `title` field).
Prior to this changeset, the filter would erroneously apply the Block Hooks algorithm to the non-existent `post_content` field regardless, which would result in it being set to the empty string `''`. As a consequence, renaming a template would have the unwanted side effect of wiping its contents.
This changeset fixes the issue by returning early from the filter if the `post_content` field is not set.
Props alshakero, bernhard-reiter.
Fixes #61550 .
Built from https://develop.svn.wordpress.org/trunk@58785
git-svn-id: http://core.svn.wordpress.org/trunk@58187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-07-23 13:43:12 +00:00
..
2024-07-18 16:03:23 +00:00
2024-03-04 14:08:24 +00:00
2024-07-18 06:50:10 +00:00
2024-07-18 16:03:23 +00:00
2024-07-18 16:03:23 +00:00
2024-06-03 20:35:13 +00:00
2024-05-02 13:19:14 +00:00
2024-07-22 23:21:14 +00:00
2023-10-20 13:29:27 +00:00
2024-02-15 23:49:10 +00:00
2024-07-16 09:44:14 +00:00
2024-07-22 10:02:15 +00:00
2024-05-15 09:07:11 +00:00
2023-10-26 20:33:22 +00:00
2023-11-26 19:27:25 +00:00
2024-03-27 12:30:12 +00:00
2024-03-25 12:23:08 +00:00
2024-07-23 07:51:12 +00:00
2023-11-02 00:04:24 +00:00
2024-07-18 13:48:15 +00:00
2024-06-03 22:04:13 +00:00
2024-01-18 22:13:16 +00:00
2023-11-26 16:43:30 +00:00
2024-05-26 20:51:13 +00:00
2024-06-03 15:44:10 +00:00
2024-06-12 12:44:13 +00:00
2024-07-10 06:19:17 +00:00
2024-02-27 21:05:11 +00:00
2024-07-23 13:43:12 +00:00
2024-03-06 05:05:12 +00:00
2024-07-02 10:03:15 +00:00
2024-03-20 12:49:10 +00:00
2024-03-23 14:20:11 +00:00
2024-02-16 23:34:11 +00:00
2024-05-05 14:35:19 +00:00
2024-04-26 15:02:14 +00:00
2024-02-17 13:25:10 +00:00
2024-03-18 15:46:13 +00:00
2024-07-18 00:52:17 +00:00
2024-06-12 12:44:13 +00:00
2024-05-02 13:19:14 +00:00
2023-11-02 00:04:24 +00:00
2024-05-02 20:09:15 +00:00
2024-05-23 18:35:14 +00:00
2024-05-30 08:54:07 +00:00
2024-05-06 21:25:15 +00:00
2023-10-12 12:34:33 +00:00
2024-05-02 00:01:09 +00:00
2024-06-13 08:57:15 +00:00
2024-06-21 17:26:14 +00:00
2024-05-14 16:49:09 +00:00
2024-07-06 14:54:16 +00:00
2024-06-03 20:35:13 +00:00
2024-05-14 16:49:09 +00:00
2024-02-16 21:47:12 +00:00
2024-06-14 12:18:11 +00:00
2024-06-20 20:27:11 +00:00
2023-12-16 09:38:25 +00:00
2024-04-07 11:18:17 +00:00
2024-06-03 20:27:12 +00:00
2024-06-14 15:26:09 +00:00
2024-02-02 17:48:15 +00:00
2024-02-27 22:38:15 +00:00
2024-01-25 07:53:17 +00:00
2024-05-26 20:51:13 +00:00
2024-02-06 01:25:14 +00:00
2024-04-22 20:25:08 +00:00
2024-06-21 17:26:14 +00:00
2024-05-13 13:34:11 +00:00
2024-07-06 14:54:16 +00:00
2024-03-06 05:05:12 +00:00
2024-06-07 23:15:16 +00:00
2024-02-16 21:47:12 +00:00
2024-05-30 15:15:10 +00:00
2024-05-27 15:24:13 +00:00
2024-05-20 21:21:16 +00:00
2023-12-24 13:05:21 +00:00
2024-06-26 13:21:17 +00:00
2024-02-05 09:43:12 +00:00
2024-06-21 17:26:14 +00:00
2024-02-16 21:47:12 +00:00
2024-03-02 13:38:07 +00:00
2024-02-14 19:27:09 +00:00
2023-10-15 14:55:23 +00:00
2024-06-28 08:51:16 +00:00
2024-06-04 11:55:14 +00:00
2024-06-24 10:33:15 +00:00
2024-06-06 08:02:16 +00:00
2024-07-18 06:43:18 +00:00
2024-04-19 17:59:16 +00:00
2024-07-19 23:44:16 +00:00
2024-05-19 19:53:19 +00:00
2024-02-16 21:47:12 +00:00
2024-03-17 09:56:16 +00:00
2024-02-11 19:14:19 +00:00
2024-04-04 15:13:14 +00:00
2024-07-18 15:09:15 +00:00
2024-06-13 13:05:13 +00:00
2024-07-18 18:04:11 +00:00
2024-05-02 13:19:14 +00:00
2024-04-17 09:46:19 +00:00
2024-07-10 06:19:17 +00:00
2024-07-10 06:19:17 +00:00
2024-06-02 22:02:16 +00:00
2024-03-04 12:41:10 +00:00
2024-03-04 12:41:10 +00:00
2024-06-13 20:50:14 +00:00
2024-06-05 23:19:17 +00:00
2024-06-30 14:58:22 +00:00
2024-07-18 18:04:11 +00:00
2024-05-26 20:51:13 +00:00
2024-05-26 20:51:13 +00:00
2024-06-13 14:48:05 +00:00
2024-07-12 19:26:14 +00:00
2024-07-06 14:54:16 +00:00
2024-07-12 03:36:15 +00:00
2024-05-04 17:27:09 +00:00
2024-05-27 16:29:16 +00:00
2024-07-06 15:07:08 +00:00
2024-07-21 18:58:16 +00:00
2024-07-20 13:32:15 +00:00
2024-03-29 11:42:13 +00:00
2024-06-13 20:50:14 +00:00
2024-04-12 17:47:13 +00:00
2023-11-13 11:13:27 +00:00
2024-03-25 17:19:17 +00:00
2024-05-04 19:25:10 +00:00
2024-05-09 15:16:14 +00:00
2024-05-08 18:37:14 +00:00
2024-07-23 00:27:15 +00:00
2024-07-04 22:01:22 +00:00
2024-05-27 16:29:16 +00:00
2024-06-01 17:37:18 +00:00
2024-06-18 14:46:10 +00:00
2024-06-02 22:02:16 +00:00
2024-07-15 01:59:16 +00:00
2024-06-13 20:50:14 +00:00
2024-07-10 06:19:17 +00:00
2024-05-26 20:51:13 +00:00
2024-05-25 03:04:12 +00:00
2024-05-03 04:47:12 +00:00
2024-06-18 04:12:11 +00:00
2024-02-21 19:26:08 +00:00
2024-07-02 23:25:18 +00:00
2023-12-08 06:32:24 +00:00
2023-10-13 17:21:22 +00:00
2024-06-12 06:11:13 +00:00
2024-06-13 20:50:14 +00:00
2024-06-13 20:50:14 +00:00
2024-07-04 22:01:22 +00:00
2024-04-04 13:40:06 +00:00
2024-07-23 13:43:12 +00:00
2024-05-26 20:51:13 +00:00