Title: SyncFields
Author: pjfc
Published: <strong>2016 年 2 月 23 日</strong>
Last modified: 2026 年 6 月 2 日

---

搜索插件

![](https://ps.w.org/syncfields/assets/banner-772x250.png?rev=1387067)

![](https://s.w.org/plugins/geopattern-icon/syncfields_d46e29.svg)

# SyncFields

 作者：[pjfc](https://profiles.wordpress.org/pjfc/)

[下载](https://downloads.wordpress.org/plugin/syncfields.4.1.zip)

 * [详情](https://cn.wordpress.org/plugins/syncfields/#description)
 * [评价](https://cn.wordpress.org/plugins/syncfields/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/syncfields/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/syncfields/#developers)

 [支持](https://wordpress.org/support/plugin/syncfields/)

## 描述

#### What does it do?

With this plugin you can map and synchronize fields in the WordPress user and usermeta
database.

Per mapping you choose the direction:
 * One-way: the primary field is copied to
the secondary field whenever it changes. * Two-way: both fields are kept in sync
in either direction. If both sides change between syncs, the conflict is detected
and resolved with primary priority (the primary field wins).

The plugin adds a new menu in the backend called ‘SyncFields’, which allows you 
to control the plugin settings.

#### Give me an example please

When you install plugins such as WooCommerce, the WordPress usermeta database table
is populated with new fields. You can map these fields and choose to automatically
sync these with other usermeta fields, or with the WordPress regular user fields.

For example, you can choose to Sync WooCommerce billing_country usermeta field with
the WordPress main Country user field. And lot’s of other ways to sync data within
WordPress, and keep it synced automatically.

#### Does it work with plugin xyz…?

Yes, it works with ANY plugin which creates usermeta fields. The plugin automatically
finds new fields every time you install a new plugin.

#### To create a new Sync between two database fields:

 * Click on ‘Add new mapping’. A list of available fields are collected. (This can
   take some time).
 * Choose the Primary Field.
 * Choose a field the primary field will sync with.
 * Click on ‘Create New Field’

Once you created a mapping between two fields, the data will remain synced for all
users. (The way it works is that every time data is changed in a field the sync 
will trigger automatically).

#### To delete a field mapping:

 * Click the ‘delete’ button in the applicable mapping row.

#### To edit a field mapping:

 * Click the ‘edit’ button in the applicable mapping row.

#### Caution:

Make sure database fields which you intend to sync are of the same type. So for 
example do not sync an email field with a Country field, this will result in invalid
data in the synced fields.
 If in doubt do NOT sync fields with each other, it may
break your site in extreme cases.

#### Tested at plugintests.com

Wonder if it will slow down your site? Wonder it creates PHP errors?
 It doesn’t.
Check this out: https://plugintests.com/plugins/wporg/syncfields/latest

## 屏幕截图

 * [[
 * The main admin screen of the plugin.
 * [[
 * The ‘Add New Mapping’ screen.
 * [[
 * The ‘Edit Mapping’ screen.

## 安装

#### For an automatic installation through WordPress:

 1. Go to the ‘Add New’ plugins screen in your WordPress admin area
 2. Search for ‘SyncFields’
 3. Click ‘Install Now’ and activate the plugin
 4. Go to the ‘SyncFields’ menu

#### For a manual installation via FTP:

 1. Upload the syncfields directory to the /wp-content/plugins/ directory
 2. Activate the plugin through the ‘Plugins’ screen in your WordPress admin area
 3. Go the ‘SyncFields’ menu

#### To upload the plugin through WordPress, instead of FTP:

 1. Upload the downloaded zip file on the ‘Add New’ plugins screen (see the ‘Upload’
    tab) in your WordPress admin area and activate.
 2. Go the ‘SyncFields’ menu

## 常见问题

### I’m missing usermeta fields

So you activated a new plugin, and expected new usermeta fields to appear in SyncFields.
But they didn’t.

Why does this happen:
 Most usermeta fields only get created in the WordPress database
once they are needed for the first time. This typically is when a user first populates
a field, and not once a plugin gets activated!

What can you do about it:
 If you miss a specific usermeta field, create a test 
customer and use the field you want to appear. For example: to make WooCommerce 
billing_country usermeta field appear, create a testcustomer and purchase a test
product whilst populating the checkout fields including the billing country for 
the test customer. At that moment new usermeta fields for WooCommerce are created
for the first time in the WordPress database (Tip: use the ‘Cash on Delivery’ payment
method so you don’t have to set up any real payment methods yet to place the test
order). After this, these usermeta fields are created, and therefore available to
SyncFields.

For details please check this:
 https://wordpress.org/support/topic/adding-fields-
6

### Does this plugin work with Headless /JamStack WordPress sites?

Yes it works.

### What is Cron Scheduling?

If you want to run a regular Sync on a Cron schedule, please use this option.
 It
normally should not be necessary because syncs are saved upon every commit.

### Where can I find the documentation

The plugin is documented in the backend. If you have any questions, feel free to
pose them in the Support section here https://wordpress.org/support/plugin/syncfields

## 评价

![](https://secure.gravatar.com/avatar/3f31e8c9864a0e3c437673490311953b3e0162fd74efaa607585387f7ddb1b9f?
s=60&d=retro&r=g)

### 󠀁[Works great for woocommerce](https://wordpress.org/support/topic/works-great-for-woocommerce/)󠁿

 [andrewfitz](https://profiles.wordpress.org/andrewfitz/) 2019 年 9 月 26 日

Use it to sync first and last names from billing to user account. Thank you!

![](https://secure.gravatar.com/avatar/84baf026ce6b98e029b6b8468a2c6fbbe8bfedc8bf25e6374a672ac38e307749?
s=60&d=retro&r=g)

### 󠀁[Very helpful tool for WooCommerce](https://wordpress.org/support/topic/very-helpful-tool-for-woocommerce/)󠁿

 [Johannes](https://profiles.wordpress.org/samariter/) 2017 年 2 月 28 日

WooCommerce and other plugins come with lots of user meta fields. With this plugin
it’s easy to automatically keep them synced. So no need to edit e.g. the customers
first name in 6 different input fields (shipping, billing, user, crm, …). Three 
feature requests: – Two-Way Sync – change the dropdown to a searchable dropdown (
my dropdown is > 400 field options) – ability to add custom fields that are not 
shown in the list.

![](https://secure.gravatar.com/avatar/cf1bb141b6c8592f1ae7d33379ce28670dd1d49dd9016d75ef95d19137018d1a?
s=60&d=retro&r=g)

### 󠀁[Awesome, thank you!](https://wordpress.org/support/topic/awesome-thank-you-11/)󠁿

 [paulbnl](https://profiles.wordpress.org/paulbnl/) 2017 年 2 月 25 日

A real time saver! I can now map my users that were registered by a Formidable form
into my Woocommerce shop. Thank you!

![](https://secure.gravatar.com/avatar/1554b74bf7fdff07aba65116f592716f82a879da388d29958b5759a6362b78e9?
s=60&d=retro&r=g)

### 󠀁[What a great tool. Perfect](https://wordpress.org/support/topic/what-a-great-tool-perfect/)󠁿

 [gato0815](https://profiles.wordpress.org/gato0815/) 2016 年 12 月 12 日

This is a very good Tool. Thank you so much.

![](https://secure.gravatar.com/avatar/dbae128ad04471b8a3939757e1b438d262c9cf0e6f90b08a02f31bd29831f872?
s=60&d=retro&r=g)

### 󠀁[simple and works perfectly](https://wordpress.org/support/topic/simple-and-works-perfectly-7/)󠁿

 [LittleBizzy](https://profiles.wordpress.org/littlebizzy/) 2016 年 9 月 8 日

Thank you for taking the time to create this plugin! It perfectly solves an annoying
issue especially common in WooCommerce sites with syncing user meta fields. The 
cron is an even nicer touch. By automating this process, our team is able to avoid
so many support requests in regard to profile updates. Well done! 🙂 — LittleBizzy

![](https://secure.gravatar.com/avatar/8e69a0c95d466d232c6177f6d3f4d9bae3a6f0d01e10a4fa95d122b07d97a5d7?
s=60&d=retro&r=g)

### 󠀁[Makes synced field read-only](https://wordpress.org/support/topic/makes-synced-field-read-only/)󠁿

 [bmarolf](https://profiles.wordpress.org/bmarolf/) 2016 年 9 月 3 日 1 回复

Does not allow manual updates to synced field in a form or in the User Profile.

 [ 阅读所有10条评价 ](https://wordpress.org/support/plugin/syncfields/reviews/)

## 贡献者及开发者

「SyncFields」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ pjfc ](https://profiles.wordpress.org/pjfc/)

[帮助将「SyncFields」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/syncfields)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/syncfields/)，查看[SVN仓库](https://plugins.svn.wordpress.org/syncfields/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/syncfields/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/syncfields/)。

## 更新日志

#### 4.1

 * Hardened request handling: wp_unslash() before sanitizing all $_GET/$_POST input,
   and escaped admin error messages
 * Bulk delete now casts mapping IDs with absint() before use
 * Two-way sync compares timestamps in UTC (time()) for consistent change detection
   across timezones
 * Log-retention cutoff computed via current_datetime() to match how log entries
   are stored
 * Full WordPress Coding Standards (PHPCS) compliance, with documented exceptions
 * Declared “Requires at least” and “Requires PHP” in the plugin header

#### 4.0

 * Complete rebuild on a modern, namespaced architecture (autoloader, service classes,
   versioned installer)
 * New: two-way sync per mapping, with primary-priority conflict resolution
 * Security hardening: prepared statements (SQL injection), output escaping (XSS),
   nonce + capability checks (CSRF)
 * New: searchable field selector with automatic field discovery and type-compatibility
   validation
 * New: activity log, dry-run preview, WP-CLI commands, and a REST field-search 
   endpoint
 * Requires WordPress 6.5+ and PHP 7.4+; tested up to WordPress 7.0

#### 3.0

Major Update: Complete Plugin Modernization and Two-Way Sync

This update represents a comprehensive overhaul of the SyncFields plugin, bringing
it up to modern WordPress standards with significant new features and improvements.

**New Feature: Two-Way Synchronization**
 – You can now choose between one-way or
two-way sync for each mapping – Two-way sync keeps both fields synchronized automatically
in both directions – Conflict detection: when both fields change between syncs, 
the conflict is resolved with primary priority (the primary field wins) so the fields
can never drift apart silently

**Enhanced Security**
 – All security vulnerabilities have been fixed – The plugin
now follows WordPress security best practices – Your data is protected with proper
input validation and output escaping

**Improved Field Selection**
 – New searchable field selector makes it easy to find
the fields you need – Automatically discovers fields from all installed plugins –
Type validation prevents incompatible field mappings

**Better User Experience**
 – Cleaner, more intuitive admin interface – Activity
log to track all synchronization events – Dry-run mode to preview changes before
applying them – WP-CLI commands for advanced users

**Developer Tools**
 – Unit tests for core helper logic (field compatibility, mapping
templates) – WP-CLI support for automation – REST API for field discovery – Comprehensive
logging system with automatic retention

**Code Quality**
 – Complete code modernization following WordPress standards – 
Improved performance and reliability – Better error handling and user feedback

#### 2.2

 * Version 2.2: Security improvements and code modernization. All security vulnerabilities
   have been fixed including SQL injection, XSS, and CSRF protection. The plugin
   now follows WordPress coding standards and is fully compatible with the latest
   WordPress versions.
 * Version 2.1: Confirmed compatability with WordPress 6.5
 * Version 2.0: Confirmed compatability with WordPress 6.1
 * Version 1.9.91: Confirmed compatability with WordPress 6.0
 * Version 1.9.9: Confirmed compatibility with latest WordPress
 * Version 1.9.8: Confirmed compatibility with latest WordPress
 * Version 1.9.7: Added FAQ, plugin works with Headless /JamStack WordPress sites
 * Version 1.9.6: Confirmed compatibility with WordPress 5.5.1
 * Version 1.9.5: Confirmed compatibility with WordPress 5.3
 * Version 1.9.4: Added security code suggested by Jeff Starr. Confirmed compatibility
   with WordPress 5.2
 * Version 1.9.3: Confirmed compatibility with WordPress 5.1
 * Version 1.9.2: Confirmed compatibility with WordPress 5.0 (first release with
   Gutenberg)
 * Version 1.9.1: Small edits, and confirmed compatibility with WordPress 4.9.8
 * Version 1.9: Confirmed compatibility with WordPress 4.9.8
 * Version 1.8: Small edits, and confirmed compatibility with WordPress 4.9.4
 * Version 1.7: Confirmed compatibility with WordPress 4.9
 * Version 1.6: Confirmed compatibility with WordPress 4.8
 * Version 1.5.2: Confirmed compatibility with WordPress 4.6
 * Version 1.5.1: Clarified plugin does one-way sync
 * Version 1.5: Corrected typos
 * Version 1.4: Backend updates to improve the flow
 * Version 1.3: Edited the FAQ
 * Version 1.2: Added to the FAQ about missing usermeta fields
 * Version 1.1.1 : Added background image
 * Version 1.0 : Stable release for production
 * Version 0.6.1 : Small changes
 * Version 0.5.4 to 0.5.9 : Edits in explanation and screenname to make things more
   consistent.
 * Version 0.5 : Stable enough to release to the public for further scrutiny 🙂
 * Version 0.4 : Stable enough to test in a production environment with WooCommerce.
   Beta testers feedback encompassed.
 * Version 0.3 : Debugging.
 * Version 0.2 : Added automatic sync functionality.
 * Version 0.1 : Initial rough thoughts, bugs to squash..

## 额外信息

 *  版本 **4.1**
 *  最后更新：**3 天前**
 *  活跃安装数量 **50+**
 *  WordPress 版本 ** 6.5 或更高版本 **
 *  已测试的最高版本为 **7.0**
 *  PHP 版本 ** 7.4 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/syncfields/)
 * 标签
 * [custom fields](https://cn.wordpress.org/plugins/tags/custom-fields/)[database](https://cn.wordpress.org/plugins/tags/database/)
   [sync](https://cn.wordpress.org/plugins/tags/sync/)[usermeta](https://cn.wordpress.org/plugins/tags/usermeta/)
   [woocommerce](https://cn.wordpress.org/plugins/tags/woocommerce/)
 *  [高级视图](https://cn.wordpress.org/plugins/syncfields/advanced/)

## 评级

 4.6 星（最高 5 星）。

 *  [  9 条 5 星评价     ](https://wordpress.org/support/plugin/syncfields/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/syncfields/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/syncfields/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/syncfields/reviews/?filter=2)
 *  [  1 条 1 星评价     ](https://wordpress.org/support/plugin/syncfields/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/syncfields/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/syncfields/reviews/)

## 贡献者

 *   [ pjfc ](https://profiles.wordpress.org/pjfc/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/syncfields/)