最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

advanced custom fields - wp_split_shared_term_batch messing up upgraded ACF 5 data

matteradmin9PV0评论

After upgrading Wordpress and associated plugins to the latest version on a dev server and migrating the source files and database to the production server, the data from ACF is different.

prod and dev server (dev is a Vagrant clone of prod)

CentOS 6.9
Apache 2.4
PHP 5.6 (php-fpm using mod_proxy_fcgi)
MySQL 5.7
DocRoot: /home/user/example

Upgrades:

Wordpress:        3.8.4  => 4.9.8
ACF:              4.4.12 => 5.7.7
ACF Repeater:     1.0.1  => 2.1.0
ACF Page Options: 1.0.1  => 2.1.0

UPDATE (removed unneeded information)

I managed to migrate the data with WP_CRON disabled. After I re-enabled WP_CRON, I encounter the issue with the data.

Looking at the data operations when manually executing wp-cron.php, I've determined that the issue is caused by wp_split_shared_term_batch.

Comparing the wp_options, wp_terms and wp_taxonomy tables from before and after running wp-cron.php shows a lot of changes with the ACF data.

  • Assigns a different term_id and parent in the wp_taxonomy table.
  • Removes and changes multiple ACF values in wp_options
  • Adds a new _split_terms row in wp_options
  • Duplicated multiple values in wp_terms

After upgrading Wordpress and associated plugins to the latest version on a dev server and migrating the source files and database to the production server, the data from ACF is different.

prod and dev server (dev is a Vagrant clone of prod)

CentOS 6.9
Apache 2.4
PHP 5.6 (php-fpm using mod_proxy_fcgi)
MySQL 5.7
DocRoot: /home/user/example

Upgrades:

Wordpress:        3.8.4  => 4.9.8
ACF:              4.4.12 => 5.7.7
ACF Repeater:     1.0.1  => 2.1.0
ACF Page Options: 1.0.1  => 2.1.0

UPDATE (removed unneeded information)

I managed to migrate the data with WP_CRON disabled. After I re-enabled WP_CRON, I encounter the issue with the data.

Looking at the data operations when manually executing wp-cron.php, I've determined that the issue is caused by wp_split_shared_term_batch.

Comparing the wp_options, wp_terms and wp_taxonomy tables from before and after running wp-cron.php shows a lot of changes with the ACF data.

  • Assigns a different term_id and parent in the wp_taxonomy table.
  • Removes and changes multiple ACF values in wp_options
  • Adds a new _split_terms row in wp_options
  • Duplicated multiple values in wp_terms
Share Improve this question edited Nov 1, 2018 at 3:29 Will B. asked Oct 29, 2018 at 15:41 Will B.Will B. 1136 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 0

After attempting many upgrades of various WP and ACF versions, I have concluded that WP 3.8 to 4.2 with ACF 4 data can not be upgraded to WP 4.3+ withACF 5.

Reason

WP 4.3 introduced a feature called split_shared_term, which affects the data used by ACF 5. ACF 4 stores the data in a manner that is re-indexed by the WP 4.3+ term splitting once it is upgraded to ACF 5. Resulting in ACF being unable to find the assigned indexes of those split terms.

I believe this is an issue with the ACF 5 database upgrade, not fully accounting for the split terms that WP 4.3+ will create from the ACF 4 data.

I have reached out to the ACF support team regarding the issue, with a general response on how the upgrade to ACF 5 may not have completed fully or an error occurred. As per their suggestion by changing the ACF version in the wp_options table and forcibly running the database upgrade again, results in duplicate data, but still invalid index references.

I managed to find a plugin that seems to mitigate the issue in ACF 4 when upgrading from WP 4.0 to 4.3, but does not work for ACF 5. The plugin is called acf-split-terms on github.

For more details about the split terms, please see https://make.wordpress/core/2015/02/16/taxonomy-term-splitting-in-4-2-a-developer-guide/

Post a comment

comment list (0)

  1. No comments so far