Skip to content

Automate ACF + Polylang Pro translations settings via WP-CLI or one-time script. Supports nested fields, easy to use, perfect for developers and automation.Script for bulk change tranlations

Notifications You must be signed in to change notification settings

NatanRock/polylang-acf-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

ACF × Polylang CLI Tools

ACF x Polylang CLI License: MIT

Tools to automate the Translations setting in ACF fields when working with Polylang Pro + ACF Pro.

No more manually setting "Copy Once", "Ignore" or "Synchronize" for each field. Automate this process and save your time.

🚀 Features

Feature Description
Bulk update Update ACF field translation modes via WP-CLI
Nested support Supports groups, repeaters, flexible content
Two methods Use either as a one-time script or as a WP-CLI plugin
Quick script One-time script for fast changes without CLI command

📦 Installation

File Location
plugin-cli.php Place in wp-content/mu-plugins (or plugins) for WP-CLI usage
script-cli.php Anywhere (optional), used with wp eval-file for one-time updates
git clone https://github.com/your-repo/cli-polylang-acf.git

✅ WP-CLI Command (recommended)

plugin-cli.php registers a custom WP-CLI command:

wp acf-polylang set --mode=copy_once --type=image

Options

Option Description
--mode ignore / copy_once / translate / synchronize / translate_once
--type image / text / textarea / wysiwyg / group / repeater / * (all types)

Examples

# Set all image fields to "Copy Once"
wp acf-polylang set --mode=copy_once --type=image

# Set all text and textarea fields to "Ignore"
wp acf-polylang set --mode=ignore --type=text,textarea

# Set everything to "Synchronize"
wp acf-polylang set --mode=synchronize --type=*

⚡ One-time Script (quick usage)

For quick changes without installing the CLI command:

wp eval-file path/to/script-cli.php

Before running, edit script-cli.php to configure:

$mode       = 'copy_once';  // Mode: ignore, copy_once, translate, synchronize
$targetType = 'image';      // Field type (or "*" for all)

When executed, all matching ACF fields will be updated recursively.

👉 How to choose method

Use case Recommended method
One-time bulk update One-time Script (simple and quick)
Regular / repeatable updates or automation WP-CLI Command (recommended)
CI/CD or deployment tasks WP-CLI Command
Developers unfamiliar with CLI One-time Script

Both methods produce the same result — choose based on your workflow and frequency of use.

📌 Notes

Tip Info
Backup Always backup your database before bulk updating fields
Sub fields Supported: group, repeater, flexible content
Auto updates Automatically updates ACF field objects in the database
ACF JSON Run wp acf sync or resave field groups after updating

📚 License

MIT — free to use, modify, and share.


Made for developers who don't want to click hundreds of fields manually. Enjoy automation and focus on what matters.


📖 Changelog

[v1.0.0] - 2025-05-05

Added

  • Initial stable release.
  • WP-CLI command support to bulk update ACF translation modes.
  • One-time PHP script for fast non-CLI usage.
  • Support for nested fields: Group, Repeater, Flexible Content.
  • MIT license.

Notes

  • Make sure to backup the database before using the bulk update scripts.
  • Compatible with ACF JSON sync workflows.

About

Automate ACF + Polylang Pro translations settings via WP-CLI or one-time script. Supports nested fields, easy to use, perfect for developers and automation.Script for bulk change tranlations

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages