Developers
How to import CJ coupons to WordPress automatically
Published 2026-06-18 · Updated June 18, 2026 · ~12 min read
Publishers running WordPress coupon sites often start by copying CJ promo codes from the publisher portal into posts by hand. That breaks the moment campaigns rotate. This guide walks through a production pattern: connect CJ in Feedico, verify normalized JSON, import into WordPress with the Feedico Sync plugin or a custom cron job, and stay compliant with CJ programme rules.
Why manual CJ import fails
CJ Affiliate rotates offers quickly during retail events. A code that worked at breakfast may expire by lunch. Manual copy-paste also hides provenance: editors paste strings without merchant ids, programme names, or expiry hints, which makes disclosure and debugging harder.
Scraping third-party coupon aggregators is worse — layouts change, codes are stale, and you inherit compliance risk from sources you do not control. The sustainable approach is a server-mediated pipeline: CJ → Feedico normalization → WordPress datastore → theme templates. Your visitors never see API tokens; your theme renders only rows your account legitimately synced.
Recommended architecture
Think in three layers. Ingestion happens in Feedico on your CJ credentials. Transport is HTTPS JSON with a bearer token stored in wp-config, environment variables, or a secrets manager — never in the browser. Presentation is WordPress: custom post types, Gutenberg blocks, or shortcodes reading from your local table or post meta.
If you also run Awin or Impact, the same WordPress templates work because Feedico maps every network into one schema. Filter by provider when a page should show CJ-only rows; omit the filter for a mixed grid. Read the CJ API via Feedico landing for positioning, then return here for WordPress wiring.
Prerequisites
- Active CJ publisher account with approved advertiser programmes.
- Feedico plan with CJ integration enabled and API quota for your sync cadence.
- WordPress 6.x+ with PHP 8.1+ (for plugin or custom cron approach).
- Ability to set server environment variables or wp-config constants for the Feedico token.
- Cache plugin (WP Rocket, LiteSpeed, etc.) configured to respect custom invalidation hooks.
Step-by-step import workflow
- Create a Feedico account and open Integrations. Add CJ credentials for the website property you operate.
- Wait for the first sync (typically minutes). Check the dashboard coupon grid or call the list API with
provider: cj_affiliate. - Generate an API token from your Feedico dashboard. Scope one token per environment (staging vs production).
- Choose integration path: official WordPress plugin for fastest setup, or custom WP-Cron for full control over post types and SEO URLs.
- Map fields from JSON to WordPress (see table below). Store
providerand external coupon id as a composite unique key to prevent duplicates on re-sync. - Schedule refresh every 15–60 minutes. Log sync duration and row counts so you notice quota or auth failures early.
- Add disclosures in the theme — CJ programme name, last verified time, and commission statement.
CJ row → WordPress field mapping
Exact JSON property names follow your OpenAPI version. Conceptually, map these Feedico fields into WordPress:
| Feedico field | WordPress target | Notes |
|---|---|---|
| code | post_title or meta _coupon_code | Skip publish if empty; show deal link only |
| title | post_excerpt / block heading | Do not alter percentage claims in editorial rewrites |
| merchant / networkName | taxonomy merchant | One term per merchant for archive pages |
| provider | meta _affiliate_provider | Always cj_affiliate on CJ-only pages |
| offerUrl | meta _outbound_url | Use rel=sponsored on front-end links |
| startsAt / expiresAt | meta _valid_until | Hide expired rows in queries |
| fetched_at | meta _verified_at | Show “verified today” badge in theme |
Verify CJ rows before WordPress
Prototype the list call from your server or terminal. Filter by merchant name fragment to match how your theme will query:
curl -sS -X POST "https://api.feedico.io/api/v1/me/coupons" \
-H "Authorization: Bearer fdco_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"page": 1,
"pageSize": 50,
"provider": "cj_affiliate",
"couponText": "Nike"
}'Paginate until recordCount is satisfied. Full contract details live on the Coupon API and REST API product page.
Plugin vs custom WP-Cron
| Approach | Best for | Trade-off |
|---|---|---|
| Feedico Sync plugin | Teams shipping fast with blocks/shortcodes | Less custom post type control |
| Custom WP-Cron + CPT | SEO-heavy sites with unique URLs per merchant | You maintain PHP sync code |
| External worker + DB | High traffic, Redis/object cache | See warehouse ETL guide |
Custom cron sketch (store token in environment, never in the theme):
// mu-plugins/feedico-cj-sync.php (sketch — run via WP-Cron or system cron)
add_action('feedico_sync_cj_coupons', function () {
$response = wp_remote_post('https://api.feedico.io/api/v1/me/coupons', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('FEEDICO_API_TOKEN'),
'Content-Type' => 'application/json',
],
'body' => wp_json_encode([
'page' => 1,
'pageSize' => 100,
'provider' => 'cj_affiliate',
]),
'timeout' => 30,
]);
if (is_wp_error($response)) return;
$payload = json_decode(wp_remote_retrieve_body($response), true);
foreach ($payload['data'] ?? [] as $row) {
// upsert custom post type keyed by provider + external id
feedico_upsert_coupon_post($row);
}
});
if (!wp_next_scheduled('feedico_sync_cj_coupons')) {
wp_schedule_event(time(), 'hourly', 'feedico_sync_cj_coupons');
}Caching, performance, and SEO
Never call Feedico on every page view — you will burn API quota and add latency. Sync to WordPress storage, then serve from object cache or static HTML. When fetched_atchanges for a merchant, bust only that merchant's cache keys instead of the entire site.
For SEO, prefer one canonical URL per merchant with editorial intro paragraphs. Auto-generated grids with duplicate titles trigger helpful content demotions. Use the WordPress affiliate use case page for broader stack guidance and the coupon warehouse guide if you outgrow post-meta storage.
Troubleshooting
- Empty sync: confirm CJ programme approvals and that the advertiser is in your connected property filters.
- 401 / 403 from API: rotate the Feedico token; verify it is not exposed in front-end JavaScript.
- Duplicate posts on each run: upsert on
provider + external_id, not on coupon code string (codes can repeat across merchants). - Stale front-end after sync: hook cache purge into the sync completion action; WP-Cron may be delayed on low-traffic sites — use system cron to trigger
wp cron event run. - Codes fail at checkout: show
fetched_atand link to official store; CJ campaigns end without notice.
Compliance and programme rules
CJ requires clear affiliate disclosures, accurate offer representation, and compliance with each advertiser's creative guidelines. Feedico supplies structured rows with provider metadata; your theme renders disclaimers. Do not imply Feedico or your site is affiliated with CJ beyond your legitimate publisher relationship. When in doubt, consult CJ publisher documentation and your account manager.
Frequently asked questions
Can I import CJ coupons to WordPress without writing PHP?
Yes. The Feedico Sync WordPress plugin pulls normalized rows on a schedule and renders blocks or shortcodes. You still configure CJ credentials in Feedico once; WordPress never stores CJ OAuth secrets if you keep the Feedico bearer token server-side.
Do I need CJ programme approval before the import works?
Yes. Feedico surfaces coupons from programmes your CJ publisher account is approved for. Connecting API credentials does not bypass CJ enrollment, category restrictions, or geo rules. Empty first sync usually means pending approvals or wrong advertiser filters.
How often should WordPress refresh CJ coupon data?
Most coupon sites sync every 15 to 60 minutes. High-traffic retail weeks may warrant 10 to 15 minute cadence if your plan quota allows. Pair scheduled pulls with webhooks on eligible plans so you invalidate HTML cache only when rows actually change.
CJ native API vs Feedico for WordPress — which is simpler?
CJ's first-party APIs are powerful for deep reporting but use a different schema than Awin or Impact. Feedico normalizes CJ rows into the same JSON envelope as your other networks, so one WordPress theme template covers every provider.
Will imported coupons hurt my SEO?
Thin auto-generated pages with duplicate titles hurt SEO. Map each merchant to a unique permalink, add editorial intro copy, and noindex archive pages with fewer than three live codes. Structured data should reflect real offer metadata, not invented discounts.
Where do affiliate disclosures go on automated coupon posts?
Render a static disclosure block in your theme footer or above the coupon grid. Include network name (CJ), last verified timestamp from fetched_at, and whether the page earns commission. Feedico supplies provider metadata; legal wording stays yours.
Related reading
You need programme approval and compliant use at each affiliate network. Feedico provides the integration layer - not a substitute for network terms.