Skip to content

fix: use the translated permalink for WPML multilingual shares#1083

Open
vytisbulkevicius wants to merge 1 commit into
developmentfrom
bugfix/pro/556
Open

fix: use the translated permalink for WPML multilingual shares#1083
vytisbulkevicius wants to merge 1 commit into
developmentfrom
bugfix/pro/556

Conversation

@vytisbulkevicius

@vytisbulkevicius vytisbulkevicius commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

With WPML, Revive Social shared posts with the correct language directory but the wrong slug — the one from the first-added language (e.g. /fr/{hindi-slug}) — so visitors landed on the wrong page.

build_url() already translates the post id to the account's language (so titles were correct), but it then also ran the URL through the wpml_permalink filter, which only rewrites the language directory and not the slug. Since WPML stores each translation as its own post, the translated id's permalink is already correct, so the extra rewrite was redundant and corrupted the slug. The URL rewrite is now kept only for TranslatePress, which uses a single post id per language.

Will affect the visual aspect of the product

NO

Test instructions

  • On a WPML site (directory-based languages) with 2+ social accounts, set each account to a different language.
  • Share a post that has translations in those languages.
  • Confirm each account's link uses the correct translated slug (e.g. /fr/{french-slug}, not /fr/{hindi-slug}).
  • On a TranslatePress site, confirm language URLs still resolve correctly.
  • On a non-multilingual site, confirm links are unchanged.

Check before Pull Request is ready:

Closes https://github.com/Codeinwp/tweet-old-post-pro/issues/556

For WPML, each translation is a separate post with its own slug. build_url()
already translated the post id to the account's language, but then also ran the
URL through the wpml_permalink filter, which only rewrites the language
directory and not the slug, producing links like /fr/{wrong-language-slug}.
Build the link from the translated post id and only keep the URL rewrite for
TranslatePress (which uses a single post id per language).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pirate-bot pirate-bot added the pr-checklist-incomplete The Pull Request checklist is incomplete. (automatic label) label Jun 19, 2026
@pirate-bot

Copy link
Copy Markdown
Contributor

Plugin build for 31a7615 is ready 🛎️!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-incomplete The Pull Request checklist is incomplete. (automatic label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants