Boone Gorges
5043f0c795
Make get_term() behave more consistently in the context of shared terms.
...
When `WP_Term` was introduced in [34997], the `$taxonomy` parameter for
`get_term()` was made optional. This meant that, when the optional param was
omitted, `get_term()` had no way of determining which term was intended when
the term_id was shared between multiple taxonomies. As a (somewhat sneaky) way
of fixing things, `get_term()` split any shared terms it found. But this could
cause problems with developer expectations: it's not clear why requesting a
term should result in a database update, much less a potential change in the
ID of a term.
In place of this technique, this changeset introduces a number of changes that
make the handling of shared terms a bit less insane:
* When a taxonomy is provided to `get_term()`, and a cached term is found matching the term_id, make sure the taxonomy also matches before returning it.
* When a taxonomy is not provided, ensure that the term is not shared before adding it to the cache.
* When a term is shared between taxonomies and no taxonomy is provided, return a `WP_Error` rather than splitting the term.
* When a term is shared between taxonomies, only one of which is valid, return the term from that taxonomy.
Props boonebgorges, dlh.
Fixes #34533 .
git-svn-id: https://develop.svn.wordpress.org/trunk@35537 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-05 16:44:59 +00:00
..
2015-09-18 08:42:24 +00:00
2015-11-04 23:42:38 +00:00
2015-11-05 01:25:54 +00:00
2015-07-23 10:02:54 +00:00
2015-06-28 00:16:17 +00:00
2015-10-31 04:41:07 +00:00
2015-11-03 15:48:37 +00:00
2015-09-20 03:51:55 +00:00
2015-10-28 01:11:57 +00:00
2015-11-04 21:22:21 +00:00
2015-10-20 05:56:59 +00:00
2015-10-24 22:44:36 +00:00
2015-10-30 10:39:02 +00:00
2015-10-20 04:56:57 +00:00
2015-10-14 17:26:28 +00:00
2015-06-28 15:26:41 +00:00
2015-10-14 23:43:10 +00:00
2015-06-22 20:54:31 +00:00
2015-09-08 22:16:57 +00:00
2015-10-21 14:02:59 +00:00
2015-10-31 20:53:41 +00:00
2015-11-04 17:53:40 +00:00
2015-09-22 13:45:48 +00:00
2015-10-18 15:34:55 +00:00
2015-10-20 16:12:21 +00:00
2015-09-22 14:19:13 +00:00
2015-09-20 03:51:55 +00:00
2015-10-23 15:42:51 +00:00
2015-11-04 18:07:45 +00:00
2015-09-16 12:45:51 +00:00
2015-10-22 18:16:12 +00:00
2015-10-06 23:44:20 +00:00
2015-07-09 07:55:44 +00:00
2015-09-16 12:45:51 +00:00
2015-09-20 03:51:55 +00:00
2015-07-08 17:15:02 +00:00
2015-09-20 03:51:55 +00:00
2015-09-22 14:02:32 +00:00
2015-10-13 17:01:10 +00:00
2015-10-10 15:44:16 +00:00
2015-09-22 13:57:23 +00:00
2015-09-22 15:08:10 +00:00
2015-10-14 17:26:28 +00:00
2015-11-04 21:09:01 +00:00
2015-10-01 03:57:53 +00:00
2015-10-24 18:56:07 +00:00
2015-11-05 00:42:23 +00:00
2015-11-04 07:28:36 +00:00
2015-10-24 18:24:21 +00:00
2015-10-24 18:20:25 +00:00
2015-10-24 18:10:17 +00:00
2015-10-24 14:41:19 +00:00
2015-10-26 14:49:25 +00:00
2015-10-07 10:35:18 +00:00
2015-05-24 05:39:47 +00:00
2015-09-26 07:03:17 +00:00
2015-09-27 21:37:00 +00:00
2015-09-03 03:27:04 +00:00
2015-09-15 16:15:39 +00:00
2015-09-03 03:29:39 +00:00
2015-10-08 19:26:44 +00:00
2015-09-26 07:03:17 +00:00
2015-10-31 20:49:26 +00:00
2015-10-31 20:49:26 +00:00
2015-08-25 20:27:56 +00:00
2015-10-14 23:43:10 +00:00
2015-10-15 22:06:38 +00:00
2015-10-31 15:37:10 +00:00
2015-10-14 23:43:10 +00:00
2015-10-08 22:06:42 +00:00
2015-09-22 13:45:48 +00:00
2015-10-14 23:43:10 +00:00
2015-09-22 13:15:45 +00:00
2015-11-05 16:44:59 +00:00
2015-10-09 21:50:05 +00:00
2015-10-14 23:43:10 +00:00
2015-10-14 23:43:10 +00:00
2015-09-14 15:32:46 +00:00
2015-09-22 13:47:09 +00:00
2015-10-13 01:12:12 +00:00
2015-10-31 20:49:26 +00:00
2015-10-29 22:50:13 +00:00
2015-08-25 20:27:56 +00:00
2015-10-06 13:53:19 +00:00
2015-07-13 21:02:06 +00:00
2015-10-31 20:12:16 +00:00
2015-11-05 15:35:06 +00:00
2015-09-22 13:43:55 +00:00
2015-10-09 04:27:41 +00:00
2015-09-26 04:50:06 +00:00
2015-10-09 16:32:59 +00:00
2015-10-20 07:34:34 +00:00
2015-11-04 21:27:41 +00:00
2015-09-22 13:35:41 +00:00
2015-10-21 14:02:59 +00:00
2015-11-01 15:41:28 +00:00
2015-11-03 15:48:37 +00:00
2015-10-20 16:20:04 +00:00
2015-11-04 17:46:41 +00:00
2015-10-20 16:20:04 +00:00
2015-10-20 16:20:04 +00:00
2015-11-04 17:46:41 +00:00
2015-10-20 16:20:04 +00:00
2015-10-24 18:49:11 +00:00
2015-11-03 21:35:17 +00:00
2015-11-04 21:27:41 +00:00
2015-06-12 16:53:17 +00:00
2015-06-12 16:53:17 +00:00
2015-10-24 18:12:10 +00:00
2015-10-23 05:53:05 +00:00
2015-10-08 19:28:14 +00:00
2015-10-13 17:17:13 +00:00
2015-10-07 17:11:01 +00:00
2015-10-19 22:38:03 +00:00
2015-10-07 03:01:27 +00:00
2015-11-04 21:38:43 +00:00
2015-10-30 22:05:22 +00:00
2015-11-04 21:43:44 +00:00
2015-10-14 23:43:10 +00:00
2015-09-22 13:29:02 +00:00
2015-10-30 02:01:32 +00:00
2015-10-14 23:43:10 +00:00
2015-09-16 22:18:33 +00:00
2015-10-14 23:43:10 +00:00
2015-06-16 20:00:15 +00:00
2015-10-21 14:02:59 +00:00
2015-10-30 09:15:42 +00:00
2015-10-05 15:05:26 +00:00
2015-10-24 17:45:11 +00:00
2015-10-30 08:56:36 +00:00
2015-10-29 11:51:21 +00:00
2015-09-20 03:51:55 +00:00
2015-10-28 18:02:41 +00:00
2015-09-25 23:57:46 +00:00
2015-08-25 20:27:56 +00:00
2015-11-04 18:28:31 +00:00
2015-10-26 15:11:53 +00:00
2015-10-12 16:59:48 +00:00
2015-09-22 13:12:55 +00:00
2015-10-20 06:32:16 +00:00
2015-10-08 19:28:14 +00:00
2015-10-22 12:16:48 +00:00
2015-09-04 01:51:08 +00:00
2015-10-15 17:52:36 +00:00
2015-08-26 04:41:29 +00:00
2015-08-25 20:27:56 +00:00
2015-10-31 04:37:41 +00:00
2015-10-29 10:31:31 +00:00
2015-11-05 16:44:59 +00:00
2015-10-10 01:58:37 +00:00
2015-10-07 10:35:18 +00:00
2015-10-28 14:05:04 +00:00
2015-10-20 16:20:04 +00:00
2015-10-05 15:05:26 +00:00
2015-10-20 05:27:32 +00:00
2015-09-22 13:02:25 +00:00
2015-09-05 22:33:01 +00:00
2015-11-04 22:02:46 +00:00
2015-10-13 01:48:41 +00:00
2015-09-03 03:13:20 +00:00
2015-10-08 17:10:58 +00:00
2015-09-20 03:51:55 +00:00