[wp-trac] [WordPress Trac] #30261: Split all existing shared taxonomy terms on WP upgrade
WordPress Trac
noreply at wordpress.org
Wed Aug 12 15:22:26 UTC 2015
#30261: Split all existing shared taxonomy terms on WP upgrade
-------------------------------------+---------------------------
Reporter: boonebgorges | Owner: boonebgorges
Type: enhancement | Status: reopened
Priority: high | Milestone: 4.3
Component: Taxonomy | Version:
Severity: blocker | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+---------------------------
Comment (by Chouby):
Replying to [comment:39 boonebgorges]:
> Yeah. There are a couple options here:
Maybe a plugin use case can help to take decisions. In
[https://wordpress.org/plugins/polylang/ Polylang] (a multilingual
plugin), terms are grouped in a translation group. I need to update this
translation group (which contains one term id per language) when a term is
splitted.
In the current stable version (which I wrote with WP 4.2 in mind), I hook
to `split_shared_term`. When term is splitted, I split all terms included
in its translation group (I need to do this as a term can not be in
several translations groups).
The approach above fails with the current `split_all_shared_terms()` as
terms splitted in Polylang are not taken into account by the core function
and I ended up with new terms having no language and no translation group.
Thus I needed to find another approach and work outside the loop. For this
I now hook to `update_option__split_terms` and `add_option__split_terms`
and create new translations groups *only* for terms which have just been
splitted (as the `_split_terms` option may already contain terms which
have already been handled since WP 4.2 is out).
> 1. Save '_split_terms' after each term is split.
For me that would work only if `split_all_shared_terms()` checks if the
term has not been already splitted (in one of the hooks)
> 2. Run the routine in batches of, say, 10 terms.
For me that would work only if the '_split_terms' option is updated only
at the end of the whole process (as otherwhise I will have translations
inside and outside the "10 terms" and it will be a big mess to deal with).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30261#comment:40>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list