Sergey Biryukov
896f5ef18f
Posts, Post Types: Pass the post object to _update_posts_count_on_delete().
...
The function checks the status of the post being deleted, and then only calls `update_posts_count()` if the deleted post was previously published, as the update query would be unnecessary otherwise.
However, by the time the function runs, the post is already deleted from the database, and the post status check fails.
This commit uses the previously retrieved post object for the status check, so that the function proceeds as expected.
Includes updating the unit test to call `wp_delete_post()` with the `$force_delete` argument, so that the post is actually deleted, not trashed, and the `after_delete_post` action is run.
Follow-up to [28835], [52207], [54760], [54762].
Fixes #57023 .
Built from https://develop.svn.wordpress.org/trunk@55419
git-svn-id: http://core.svn.wordpress.org/trunk@54952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-24 01:23:20 +00:00
..
2023-02-21 13:09:42 +00:00
2023-02-23 21:34:19 +00:00
2023-02-21 13:09:42 +00:00
2023-02-21 13:09:42 +00:00
2023-02-23 11:06:19 +00:00
2023-02-22 20:55:23 +00:00
2022-10-04 02:08:11 +00:00
2023-01-20 01:36:10 +00:00
2023-02-21 13:09:42 +00:00
2022-12-08 19:31:17 +00:00
2022-12-06 12:19:15 +00:00
2022-12-12 20:21:12 +00:00
2022-12-19 15:12:11 +00:00
2023-02-17 15:45:24 +00:00
2023-02-03 13:35:20 +00:00
2022-09-26 14:00:10 +00:00
2023-02-01 16:15:15 +00:00
2022-11-26 21:01:17 +00:00
2023-02-22 22:02:23 +00:00
2023-02-23 12:34:18 +00:00
2023-02-21 16:39:19 +00:00
2023-02-20 21:13:27 +00:00
2023-02-06 19:40:16 +00:00
2023-02-02 19:38:19 +00:00
2023-02-14 15:57:21 +00:00
2023-01-24 14:42:17 +00:00
2023-02-21 16:39:19 +00:00
2022-10-10 18:22:11 +00:00
2022-10-10 18:22:11 +00:00
2023-02-15 13:06:21 +00:00
2022-11-29 15:51:14 +00:00
2023-02-04 15:18:16 +00:00
2023-02-03 13:35:20 +00:00
2023-02-13 09:08:23 +00:00
2023-02-11 12:43:22 +00:00
2022-12-15 21:32:17 +00:00
2023-02-03 13:35:20 +00:00
2023-02-03 13:35:20 +00:00
2023-02-07 14:05:20 +00:00
2022-11-29 15:51:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2023-02-07 07:04:52 +00:00
2022-09-12 15:47:14 +00:00
2023-02-01 15:29:13 +00:00
2022-09-12 15:47:14 +00:00
2023-02-06 15:24:16 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-11-29 21:00:14 +00:00
2022-11-23 21:30:13 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2023-02-07 17:10:21 +00:00
2023-02-23 10:38:21 +00:00
2023-02-07 17:10:21 +00:00
2023-02-07 17:10:21 +00:00
2023-02-07 17:10:21 +00:00
2022-09-12 15:47:14 +00:00
2023-02-07 17:10:21 +00:00
2022-11-08 13:29:16 +00:00
2022-11-25 15:12:16 +00:00
2022-11-25 15:12:16 +00:00
2023-02-21 16:39:19 +00:00
2023-02-19 15:05:22 +00:00
2023-02-21 16:39:19 +00:00
2023-02-23 10:38:21 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-10-21 21:12:14 +00:00
2022-12-15 21:32:17 +00:00
2022-12-15 21:32:17 +00:00
2022-09-12 15:47:14 +00:00
2023-01-13 14:22:12 +00:00
2023-02-21 01:49:20 +00:00
2022-09-19 22:53:10 +00:00
2023-02-22 14:25:25 +00:00
2022-10-07 19:17:12 +00:00
2022-11-17 18:15:19 +00:00
2023-02-08 17:08:21 +00:00
2023-02-15 23:37:17 +00:00
2022-09-12 15:47:14 +00:00
2023-02-21 16:39:19 +00:00
2022-09-12 15:47:14 +00:00
2022-10-18 18:16:16 +00:00
2022-09-20 14:26:10 +00:00
2022-09-26 22:10:16 +00:00
2022-11-13 13:51:20 +00:00
2023-02-23 10:38:21 +00:00
2022-09-12 15:47:14 +00:00
2022-09-26 22:10:16 +00:00
2022-09-12 15:47:14 +00:00
2023-02-07 12:10:18 +00:00
2022-10-04 03:59:13 +00:00
2023-01-30 10:27:16 +00:00
2023-02-21 15:59:18 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-10-04 23:01:13 +00:00
2022-09-12 15:47:14 +00:00
2022-10-24 14:56:16 +00:00
2022-09-28 22:19:10 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2022-10-18 18:16:16 +00:00
2022-09-12 15:47:14 +00:00
2022-09-28 14:59:10 +00:00
2022-11-23 21:30:13 +00:00
2022-11-26 09:39:13 +00:00
2023-01-18 09:58:16 +00:00
2022-09-12 15:47:14 +00:00
2023-01-30 15:24:13 +00:00
2023-02-07 17:10:21 +00:00
2023-02-15 22:56:20 +00:00
2022-10-11 15:00:12 +00:00
2023-02-07 16:44:24 +00:00
2022-09-12 15:47:14 +00:00
2023-02-15 22:56:20 +00:00
2023-02-14 14:38:22 +00:00
2022-11-08 17:31:13 +00:00
2022-09-12 15:47:14 +00:00
2022-11-29 15:51:14 +00:00
2022-09-12 15:47:14 +00:00
2022-09-12 15:47:14 +00:00
2023-02-21 16:39:19 +00:00
2023-02-19 15:05:22 +00:00
2022-10-18 16:11:16 +00:00
2023-02-23 11:13:22 +00:00
2022-09-20 14:17:12 +00:00
2022-09-20 14:17:12 +00:00
2022-09-20 14:17:12 +00:00
2023-02-21 16:39:19 +00:00
2023-02-21 16:39:19 +00:00
2023-01-25 01:40:12 +00:00
2023-02-07 21:21:18 +00:00
2022-09-20 01:36:09 +00:00
2023-02-03 00:15:21 +00:00
2023-02-19 15:05:22 +00:00
2022-08-19 22:06:09 +00:00
2022-11-26 21:01:17 +00:00
2023-02-12 18:08:21 +00:00
2023-02-23 11:06:19 +00:00
2023-02-23 10:38:21 +00:00
2023-01-15 14:57:13 +00:00
2023-01-15 14:57:13 +00:00
2023-02-07 17:10:21 +00:00
2023-02-02 18:52:17 +00:00
2022-12-15 21:32:17 +00:00
2022-08-11 14:11:08 +00:00
2023-02-13 08:47:21 +00:00
2023-02-15 23:37:17 +00:00
2023-02-18 15:09:18 +00:00
2023-02-23 11:13:22 +00:00
2023-02-07 17:10:21 +00:00
2023-02-13 18:34:17 +00:00
2023-02-21 16:39:19 +00:00
2023-02-24 01:23:20 +00:00
2023-02-24 01:23:20 +00:00
2022-12-09 11:54:13 +00:00
2023-02-21 16:39:19 +00:00
2023-02-23 10:38:21 +00:00
2022-10-18 18:16:16 +00:00
2022-12-07 21:19:19 +00:00
2023-02-16 00:04:21 +00:00
2023-02-15 22:56:20 +00:00
2023-02-07 12:49:17 +00:00
2023-02-12 18:08:21 +00:00
2023-02-21 16:39:19 +00:00
2023-02-07 14:35:23 +00:00
2023-01-19 07:34:14 +00:00
2023-02-21 21:04:17 +00:00
2022-12-13 12:26:15 +00:00
2023-02-07 21:21:18 +00:00
2023-02-22 20:49:20 +00:00
2022-12-15 11:03:11 +00:00
2023-02-21 16:39:19 +00:00
2023-02-23 21:34:19 +00:00
2023-01-23 16:35:12 +00:00
2022-09-14 12:48:16 +00:00
2023-02-14 15:46:18 +00:00
2022-12-22 11:08:19 +00:00
2022-09-21 11:43:13 +00:00
2023-02-19 15:05:22 +00:00
2023-02-22 16:00:21 +00:00
2023-02-03 00:15:21 +00:00
2022-11-29 15:51:14 +00:00
2023-02-23 11:06:19 +00:00
2023-02-23 10:38:21 +00:00
2023-02-24 01:23:20 +00:00
2023-02-23 11:06:19 +00:00