Felix Arntz
8db8a24e46
Media: Introduce wp_get_attachment_image_context
filter.
...
Since WordPress 5.9, a "context" value of "wp_get_attachment_image" has been used in the `wp_get_attachment_image()` function to provide context to underlying functions where that is relevant, e.g. `wp_get_loading_attr_default()`. Since that value used to be not customizable, it required a workaround in `get_the_post_thumbnail()` to avoid calling those functions in `wp_get_attachment_image()`, which resulted in unnecessary complexity and was prone to errors.
This changeset introduces a `wp_get_attachment_image_context` filter and leverages it with private filter callback functions that are leveraged by default when `get_the_post_thumbnail()` is called. This avoids the need for the previous workaround and furthermore provides flexibility for other callers of `wp_get_attachment_image()` to provide their own contexts.
Props flixos90, costdev, thekt12, westonruter, spacedmonkey.
Fixes #58212 .
Built from https://develop.svn.wordpress.org/trunk@55821
git-svn-id: http://core.svn.wordpress.org/trunk@55333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-17 18:31:24 +00:00
..
2023-05-09 14:13:25 +00:00
2022-04-12 09:26:16 +00:00
2023-03-13 16:32:20 +00:00
2023-05-09 14:13:25 +00:00
2023-03-21 12:43:46 +00:00
2023-02-23 11:06:19 +00:00
2023-05-09 11:19:21 +00:00
2022-10-04 02:08:11 +00:00
2023-04-04 14:56:22 +00:00
2023-01-20 01:36:10 +00:00
2023-05-16 14:27:21 +00:00
2022-12-08 19:31:17 +00:00
2023-03-17 14:22:22 +00:00
2022-12-12 20:21:12 +00:00
2023-04-05 13:12:26 +00:00
2023-05-06 11:40:24 +00:00
2023-02-03 13:35:20 +00:00
2023-04-30 14:08:23 +00:00
2023-05-17 12:06:19 +00:00
2023-05-12 08:51:22 +00:00
2022-11-26 21:01:17 +00:00
2023-05-02 15:45:22 +00:00
2023-02-23 12:34:18 +00:00
2022-04-21 11:24:17 +00:00
2023-05-14 17:58:24 +00:00
2023-03-01 11:43:20 +00:00
2023-02-06 19:40:16 +00:00
2023-05-17 09:23:24 +00:00
2023-05-16 14:21:18 +00:00
2023-05-16 14:23:19 +00:00
2023-05-02 15:45:22 +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
2022-08-04 14:52:11 +00:00
2022-06-17 11:20:13 +00:00
2023-02-03 13:35:20 +00:00
2022-06-17 11:20:13 +00:00
2023-02-13 09:08:23 +00:00
2023-02-11 12:43:22 +00:00
2023-04-05 13:12:26 +00:00
2023-05-12 21:35:21 +00:00
2023-02-03 13:35:20 +00:00
2023-02-07 14:05:20 +00:00
2022-05-01 22:01:10 +00:00
2023-03-21 20:00:19 +00:00
2022-09-12 15:47:14 +00:00
2023-05-08 22:37:24 +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-04-27 22:29:18 +00:00
2022-09-12 15:47:14 +00:00
2023-05-08 22:37:24 +00:00
2023-04-27 22:29:18 +00:00
2022-09-12 15:47:14 +00:00
2023-04-21 10:43:25 +00:00
2022-11-23 21:30:13 +00:00
2023-05-11 12:27:22 +00:00
2023-04-24 16:37:22 +00:00
2023-02-07 17:10:21 +00:00
2023-05-02 15:45:22 +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-05-02 15:45:22 +00:00
2023-05-08 22:37:24 +00:00
2022-11-25 15:12:16 +00:00
2022-11-25 15:12:16 +00:00
2023-04-12 09:43:21 +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
2023-05-11 11:43:21 +00:00
2022-09-12 15:47:14 +00:00
2023-04-11 22:06:22 +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
2023-02-25 10:59:22 +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-05-08 22:37:24 +00:00
2023-05-11 11:15:24 +00:00
2023-03-10 16:30:03 +00:00
2022-09-20 14:26:10 +00:00
2023-03-14 16:55:19 +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
2023-04-27 23:15:17 +00:00
2022-09-12 15:47:14 +00:00
2023-05-11 12:27:22 +00:00
2022-10-04 03:59:13 +00:00
2023-05-02 15:45:22 +00:00
2023-02-21 15:59:18 +00:00
2022-09-12 15:47:14 +00:00
2023-05-02 15:45:22 +00:00
2023-04-10 12:56:21 +00:00
2022-09-12 15:47:14 +00:00
2022-10-24 14:56:16 +00:00
2023-05-02 15:45:22 +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-05-11 11:15:24 +00:00
2022-09-12 15:47:14 +00:00
2023-05-02 15:45:22 +00:00
2023-05-08 22:37:24 +00:00
2023-04-27 23:15:17 +00:00
2023-04-21 09:24:22 +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-04-27 23:15:17 +00:00
2023-05-06 11:40:24 +00:00
2023-05-08 17:32:24 +00:00
2023-05-02 15:45:22 +00:00
2023-05-08 22:37:24 +00:00
2022-09-12 15:47:14 +00:00
2023-05-08 22:37:24 +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-04-17 17:01:24 +00:00
2023-05-02 15:45:22 +00:00
2023-05-08 22:37:24 +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-05-11 12:27:22 +00:00
2023-05-12 21:35:21 +00:00
2023-05-07 11:44:21 +00:00
2023-04-09 11:57:22 +00:00
2022-06-17 11:20:13 +00:00
2022-09-20 01:36:09 +00:00
2023-05-17 18:31:24 +00:00
2023-05-12 21:35:21 +00:00
2022-06-17 11:20:13 +00:00
2022-08-19 22:06:09 +00:00
2023-05-02 15:45:22 +00:00
2022-11-26 21:01:17 +00:00
2023-02-12 18:08:21 +00:00
2023-05-12 21:35:21 +00:00
2023-05-16 14:18:20 +00:00
2023-05-02 15:45:22 +00:00
2023-05-08 22:37:24 +00:00
2023-01-15 14:57:13 +00:00
2023-05-02 15:45:22 +00:00
2023-05-03 18:48:22 +00:00
2023-04-27 23:15:17 +00:00
2023-04-04 14:56:22 +00:00
2023-05-02 15:45:22 +00:00
2023-05-16 14:18:20 +00:00
2023-05-10 17:36:21 +00:00
2023-04-24 13:53:22 +00:00
2023-03-07 04:47:22 +00:00
2023-05-17 18:31:24 +00:00
2023-05-17 09:44:18 +00:00
2023-04-24 13:53:22 +00:00
2022-07-14 13:35:13 +00:00
2023-02-24 01:23:20 +00:00
2022-12-09 11:54:13 +00:00
2023-04-18 11:50:27 +00:00
2023-02-23 10:38:21 +00:00
2023-05-02 11:26:24 +00:00
2023-05-11 11:15:24 +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-05-02 15:45:22 +00:00
2023-05-12 21:35:21 +00:00
2023-02-21 16:39:19 +00:00
2023-05-02 15:45:22 +00:00
2023-05-17 18:31:24 +00:00
2023-05-10 17:36:21 +00:00
2023-03-10 16:30:03 +00:00
2023-05-02 15:45:22 +00:00
2023-02-22 20:49:20 +00:00
2023-05-02 15:45:22 +00:00
2022-04-06 15:33:03 +00:00
2023-04-10 19:31:18 +00:00
2023-05-17 12:06:19 +00:00
2023-05-03 18:48:22 +00:00
2023-05-17 12:06:19 +00:00
2023-05-16 12:31:21 +00:00
2023-04-10 12:56:21 +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-05-02 15:45:22 +00:00
2023-05-04 02:36:23 +00:00
2023-05-11 11:15:24 +00:00
2023-02-23 10:38:21 +00:00
2023-05-17 18:31:24 +00:00
2023-02-23 11:06:19 +00:00
2022-07-21 22:45:11 +00:00