[wp-trac] [WordPress Trac] #36949: Term exists should use get_terms internally
WordPress Trac
noreply at wordpress.org
Fri Apr 21 20:36:05 UTC 2017
#36949: Term exists should use get_terms internally
--------------------------+-----------------------------
Reporter: spacedmonkey | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Taxonomy | Version: 2.3
Severity: normal | Resolution:
Keywords: has-patch | Focuses: performance
--------------------------+-----------------------------
Comment (by boonebgorges):
[attachment:36949.3.patch] includes some formatting cleanup.
I looked into one of the failures -
`Tests_Import_Import::test_small_import()`. What's happening here is that
the importer suspends cache validation, such that parent-term lookups fail
during bulk term import. So here's a real-life instance of the kind of
case [comment:2 I hypothesized above]. I assume the other failures are
similar. We have a couple options available.
1. Don't suspend cache invalidation for bulk operations.
2. Don't use `term_exists()` during bulk operations. (We'd use some
version that skips the cache.)
3. Don't change the behavior of `term_exists()`
It's fairly easy to make the internal changes necessary for 1 and 2, but
both are going to cause serious problems for third-party libraries that
suspend cache invalidation for imports and other bulk operations.
I think `term_exists()` is not a great function anyway, and I wouldn't
mind if we moved away from its use in core. If we phased out our own
internal uses, we could replace them with functions that leverage the
cache, and also demonstrate the proper way to handle bulk operations
(perhaps those would continue to use `term_exists()`?).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36949#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list