Salesforce WordPress Sync
WordPress Plugin
by Adam Vauthier (Portfolio) · github.com/adamvauthiertl/wp-saleforce-object-sync · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/adamvauthiertl/wp-saleforce-object-sync/archive/refs/heads/main.zipSalesforce → WordPress Sync (Portfolio Sample)
This WordPress plugin demonstrates a practical pattern for syncing Salesforce records into WordPress Custom Post Types and Advanced Custom Fields (ACF). It supports scheduled incremental sync, manual sync triggers, and basic logging.
Notes
- This repo is intended as a public portfolio sample. It contains no credentials.
- Salesforce object/field API names in this repo are examples and should be adapted to your org.
Highlights
- Hourly WP-Cron sync (incremental)
- Manual incremental + full sync from wp-admin
- SOQL query builder with optional filters
- Field mapping layer to ACF fields
- Simple logging to a custom database table
Requirements
- WordPress 5.0+
- PHP 7.4+
- Advanced Custom Fields (ACF)
- A target WordPress CPT registered (example:
agency) - Salesforce Connected App credentials
Recommended credential storage (wp-config.php)
For security, you can store credentials outside the database by defining constants in wp-config.php:
define('SFWP_CONSUMER_KEY', 'YOUR_CONNECTED_APP_CONSUMER_KEY');
define('SFWP_CONSUMER_SECRET', 'YOUR_CONNECTED_APP_CONSUMER_SECRET');
define('SFWP_USERNAME', 'your-salesforce-username');
define('SFWP_PASSWORD', 'your-salesforce-password');
define('SFWP_SECURITY_TOKEN', 'your-security-token'); // optional
define('SFWP_IS_SANDBOX', false); // true for sandbox (test.salesforce.com)
If these constants are defined, the plugin will prefer them over values saved in wp-admin.
Installation
- Copy this plugin folder to:
/wp-content/plugins/salesforce-wp-sync/
- Activate: Plugins → Salesforce WordPress Sync
- Configure: SF Sync (menu in wp-admin)
- Click Run Sync Now (Incremental) to test.
Salesforce setup (Connected App)
Create a Connected App with OAuth enabled and capture the Consumer Key and Consumer Secret. This plugin uses the username/password OAuth flow for simplicity in a server-side sync job.
Configuration
Settings live in SF Sync:
- Object name (default:
Account— change to your custom object API name) - Optional filters:
- Record Type name
- Federation agency field filter (example)
- “Delete removed records” option to clean up posts that no longer exist or no longer match filters
Field mapping
Field mapping is defined in:
includes/class-salesforce-api.php(SOQL fields)includes/class-field-mapper.php(Salesforce → ACF field names)
Adapt the field list and mappings to match your Salesforce schema and ACF field keys/names.
License
GPL-2.0-or-later
Developer hooks
You can customize behavior without editing core plugin files:
sfwp_soql_fields— adjust the SOQL field listsfwp_where_conditions— adjust WHERE conditions (filters)sfwp_mapped_fields— adjust mapped ACF fields per recordsfwp_field_mapping— customize the mapping shown on the settings page