Support » Plugin: Polylang » [Plugin: Polylang] BUG: Creating new language doesn't copy original's metadata

  • You may have a philosophical argument with how I believe this should work, but hear me out…

    If I have a post written in one language, I’ve probably set all my tags, some custom fields, a category, and probably a number of other details from 3rd-party plugins.

    Creating a new translation of that post should really mean creating a *DUPLICATE* of the original post in all respects, except the body of the post and the excerpt.
    (i.e. the metadata relating to the post – it’s category, fields, etc. hasn’t changed, only the words themselves).

    However, clicking “Add New” creates a blank post with merely a relationship to the original language.

    I’d like to suggest that this is an extremely necessary feature that’s not yet in Polylang – clicking “Add New” should duplicate the post, then blank-out the value of the editor and excerpt textboxes.

    This way, we’re really *re-creating* the post in a new language, rather than starting completely from scratch…

    This would save a LOT of work, and ensure consistency across languages (i.e. search results and SEO would work properly, etc.)

    Perhaps integrating code from plugins like “Duplicate Post” (or other clone-post plugins) would be a helpful start…. I’d be happy to assist where I can, as I intend to use this plugin on a complete encyclopedia reference site I’m working on!!!

    Great work tho, keep it up.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Chouby


    I would not say it is bug, but rather a lacking feature. You may be happy to learn that copy (translated) categories and tags is already on the roadmap. I don’t know yet when I will release that however. For post metas, I have to think more. It may help in some cases, and disturb things in others.

    Put it in, I’ll test and help develop it! The sooner the better! Great to hear.

    To get around “disturbances”, it could simply be an option (copy or not) in Polylang’s settings.

    Plugin Author Chouby


    What I am currently doing for v0.6 is:
    * copy translated categories and post tags if a translation is available
    * copy translated parent of page if a translation is available
    * copy page template as is.

    That’s excellent… Could I suggest you think of it a little differently though:

    If you do a straight copy on creation of a new translation, the linked articles may eventually get out of sync.

    Say I create a new translation from post 855 (English) which becomes post 900 (French).

    The tags get copied from 855, and any tags which have French translations get put into the metadata of post 900.

    (Note – when I say “tags”, really it can apply to Categories, Taxonomies, and anything else with a translation)

    The next day, I add/change/delete the tags from the English article.
    French will still have the “old” tags.

    I later translate a tag of 855 into French.
    900’s metadata, which *would* have had the French tag added if I had translated earlier, will not get updated with the now-translated tag.

    If you create a new table containing the links between articles like this:

    Lang1ID  |  Lang2ID  |  Lang3 ID  |  etc.
      855    |     900   |

    you could also add a filter for the_content (or perhaps the_tags) which:
    – reads the tags on all linked articles (in this case, 855 and 900)
    – checks if any tags exist in Lang1 that have a translation to Lang2
    – permanently or temporarily adds the translated tag to the article’s translation (selectable as an admin option)

    Now, when I read the French article 900, *after* I’ve added some new tag translations, and removed some tags from article 855, I will *still* see matching tags in both.

    This would also let you add a button where you could “sync” article tags (and categories, taxonomies, etc.) by looping through every post like this:

    - foreach post_ID in the default language
         - make an array translations of all it's translations
         - make an array defaultLangTags of it's tag/tax/cat ID's in the default language
       - foreach translationLang in translations
         - foreach tag in defaultLangTags
           - see if a translation exists in translationLang for that tag
           - apply it to translationLang's post_ID
         - (repeat for cat's, tax's, etc.)

    This goes hand-in-hand with my other post about “flipping languages”:
    You will be able to click on French / English flags, and read the article in either language, and also see the same tags in both articles (assuming translations exist. Maybe as an option, you could show tags from the default language if the default language’s article has a tag for which no translation exists.)

    Currently, it sort of looks like there’s an English article (post), and a French article – but they’re separate articles.

    Combined together, (this post and the flag post), Polylang could make it look like an article is “An Article” (unified), and all you have to do to read it in a different language, is click on the flag!

    Anyways, my site is totally in development – not “production” at all, so I’m happy to put 0.6 on and play around and help you code it.

    Email me at if you’d like to discuss further.


    Plugin Author Chouby


    I believe that this feature is quite interesting. I want to include it in V0.6. This time, I will probably release a development version (quite soon) before the final release. I would be very happy if you could test it.

    Plugin Author Chouby


    I released a development version. You can look at the dedicated thread to know more.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Polylang] BUG: Creating new language doesn't copy original's metadata’ is closed to new replies.