WP Manifestindependent plugin directory
manifest / i18n / polylang-rest-connector

Polylang REST API Connector

Expose Polylang language and translation data to the WordPress REST API to allow an external automation tool (i.e. n8n) to read translation status and link new translations programmatically.

★ 1stars

Install

Download source zip No release zip yet

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/japaneseknotweedbe/polylang-rest-connector/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Expose Polylang language and translation data to the WordPress REST API to allow an external automation tool (i.e. n8n) to read translation status and link new translations programmatically.

Instructions

  1. Create a file named polylang-rest-connector.php.

  2. Paste the code below into that file.

  3. Upload it to your wp-content/plugins/ folder and activate it, OR place it inside wp-content/mu-plugins/ to force activation.

Implementation Details

  • Security: Checks if Polylang is active (function_exists('pll_default_language')) before executing to prevent site crashes.

  • Dynamic Support: Automatically detects all public post types (Posts, Pages, etc.) via get_post_types.

  • Read (GET): Adds lang (string) and translations (object) to the API response.

  • Write (POST/PUT): Hooks into rest_insert_{post_type} to handle the side-effects of setting language and linking translations.