How to manually link posts to each other in Wordpress

I have two language versions for each of my pages using Polylang plugin. There's a language switcher on every page. But somehow I created two posts not connected to each other (first two in the list). How can I interconnect them so language switcher works properly?

Topic plugin-polylang multi-language posts Wordpress

Category Web


You have to set the language for all existing categories and post tags, otherwise they won’t be displayed in the autocomplete input field.

Source


I'll use as example two pages: Hello (en) and Bonjour (fr).

  1. Click "Edit" in page Hello (doesn't really matter which one)
  2. At the right sidebar there will be the language of the current page (English) and a list of flags of other languages with a plus symbol (to create another page) and a text input beside it: Sample page
  3. In this text input, start typing the page title of the translated page (on our example, Bonjour). The input will suggest the other page, just click on it and save, it will link each other.

Source


pll_save_term_translations Defines which terms are translations of each other Usage:

pll_save_term_translations($arr);

‘$arr’ => (required) associative array of translations with language code as key and term id as value

https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.