• When the hook split_shared_term() had been introduced with WP 4.2, I added a function to my plugin that takes care of my custom termmeta implementation. Currently my plugin requires at least WP 3.7 but I want to change this to at least WP 4.4 and use the official termmeta.

    Now my question is: Since all terms have been forcefully split with WP 4.3, is it safe to remove my split_shared_term function? Technically, no one should be able to install/use the new version of the plugin (with the requirement WP 4.4) while having unsplit terms.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Hmmm. For the most part I think you’re safe. What if some slow to update user has an old version of WP and an old version of your plugin prior to when the split shared term hook was implemented? Then they deactivate your plugin and upgrade WP. I don’t know why, people do weird things. Then they activate your latest and greatest after the WP upgrade did whatever it does to the user’s old data.

    What happens to the user’s old data? Something to think about even if very unlikely. It’s at least conceivable it could happen. Yes?

    Thread Starter Andreas Brain

    (@abrain)

    Good point! There are up to 20 installs that possibly use a version without the split shared term hook. (Can’t really tell, I introduced it in a patch release, so the stats don’t help me there)

    So I came up with this:
    There will be an update function, that converts the termmeta from the custom implementation to the official implementation. This is something every active install will execute before doing anything else (update mechanism based on plugin-specific version number in the db, as you do). For every conversion wp_get_split_term() is called to check if the term has been split in the past without the plugin noticing. Depending on the return value, the term id from my custom termmeta entry is used or the newly assigned term id that the plugin wasn’t aware of yet (for whatever reason).

    Since the new version of the plugin requires WP 4.4, the terms got split before my update function runs, no matter what. The update function then takes care of all the terms, whether they were previously processed by the split shared term hook or not.

    Moderator bcworkz

    (@bcworkz)

    Perfect! No holes in that plan 🙂

    Thread Starter Andreas Brain

    (@abrain)

    Great, thanks a lot for the support 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Drop support for split_shared_term() with WP >= 4.4?’ is closed to new replies.