Sync Post with Language Addon
An add-on for the existing WordPress plugin "Sync Post with Other Site" by incorporating OpenAI's translation capabilities. This add-on should automatically translate posts from English to multiple languages including Italian, Spanish, and German, while maintaining the HTML structure.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/sagarlakhani024/sync-post-with-language-addon/archive/refs/heads/main.zipThis WordPress plugin is an add-on for the Sync Post With Other Site plugin. It uses the OpenAI GPT-4o model to automatically translate Gutenberg block-based content into different languages while preserving the original HTML structure and block hierarchy.
🧩 Features
- 🧠 Translates full post content using OpenAI GPT-4o
- 🔤 Supports multiple languages (Italian, German, Spanish, French, Dutch)
- 🧱 Maintains original Gutenberg block structure
- 🌐 Language selection via WordPress admin settings
- 📤 Integrates with the "Sync Post With Other Site" plugin to sync translated content
- 🔐 Secures API access using stored OpenAI API Key
⚙️ Requirements
- PHP 7.4 or higher
- WordPress 5.8+
- Sync Post With Other Site plugin
- OpenAI API key (Get one here)
🛠️ Installation
- Upload the plugin to your
/wp-content/plugins/directory or install via the Plugins menu. - Activate the plugin through the Plugins menu in WordPress.
- Go to Settings > OpenAI Translation Settings to:
- Enter your OpenAI API key
- Choose the target translation language
- Posts synced via "Sync Post With Other Site" will now be translated before sending.
🧪 Supported Block Types
All block types that use innerHTML or innerContent, including:
- Paragraphs
- Headings
- HTML blocks
- Lists
- Custom blocks with textual content
🔒 Security
- Uses WordPress nonces for settings forms
- Sanitizes and validates all inputs
- API key is stored securely via
update_option
📦 Customization
You can extend or customize:
- The list of supported languages
- The translation model used (currently
gpt-4o) - Filters/hooks to modify how blocks are processed
🛠 Development
This plugin adheres to WordPress coding standards. To check coding quality:
composer install
vendor/bin/phpcs --standard=WordPress .
vendor/bin/phpcbf --standard=WordPress .