Support » Plugin: Multisite Language Switcher » How to change current language

  • Resolved Goran

    (@goran63)


    I have the site in two languages. When I change one language, links to another language are gone until I manually edit (open, update) every post, page, taxonomies… Is there a way to do that in bulk? Thanks.

    • This topic was modified 2 months, 2 weeks ago by Goran.
    • This topic was modified 2 months, 2 weeks ago by Goran.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    Hello, can you elaborate on what you are trying to archive? Where do you change the language?

    Thread Starter Goran

    (@goran63)

    Hello Dennis,
    Happy New Year. Thanks for your time. I’ve changed language at WordPress> Settings > General > Language. After that, all links between posts are gone. To establish links again I have to open every post and click on “Update”. Any chance to speed up the process a bit? Thanks.

    Plugin Author Dennis Ploetner

    (@realloc)

    Hello, you get probably the links back when you switch back to the language that you had set before. Do you confirm?

    I don’t understand though why you would change the language. What is the use case here?

    You can probably change the saved options. Is that something you would like to archive?


    Thread Starter Goran

    (@goran63)

    Hello, sorry but I can’t change back language. The use case is as follows: client have 4 sites in 4 countries with almost the same content. So, I’ve cloned the main site, and then change the main language to the new one (English is the second language). Hope this makes sense.

    Plugin Author Dennis Ploetner

    (@realloc)

    I see. I believe there is a way to automate this but it needs a bit extra work (custom code).

    The options are saved separately in every blog in the *_options-tables. They are synched so they have in your case basically the same values. You can find some options in the database that start with msls_*. The stored value is an array that contains a structure like (just an example):

    a:2:{s:5:"de_DE";i:42;s:5:"en_GB";i:42;}

    which stands for (language code => post ID):

    [ 'de_DE' => 42, 'en_GB' => 42 ]

    It should be possible to select all values, loop over them and add the missing languages with the same values (since you cloned the content).

    Hope this helps.

    Thread Starter Goran

    (@goran63)

    Thanks! It helps, but some code hint would help more… 🙂
    Have a nice day.

    Thread Starter Goran

    (@goran63)

    JFYI this code has done the job:
    UPDATE table1 SET field1 = REPLACE(field1, ‘code1’, ‘code2’) WHERE field1 LIKE ‘msls_%’;

    Thanks for following up. This thread should be marked as resolved, BTW.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.