• Hello,

    we are using some custom strings for our website added by pll_register_string function. Where are these strings stored in database? Can you confirm that it is wp_options table and strings are stored as arrays with option name ‘polylang_mo##’ where ## is ID of language?

    Thanks in advance for your reply.

    Michal

    https://www.ads-software.com/plugins/polylang/

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

    (@chouby)

    Hi!

    No it’s not in wp_options but in wp_posts.
    post_type: ‘polylang_mo’
    post_title: ‘polylang_mo_##’ where ## is ID of language
    post_conten: serialized array of strings translations

    Thread Starter myso

    (@myso182)

    Hi Chouby,

    Thanks for your reply!

    It looks like strings were stored on wp_options table in previous versions of plugin. We were using 1.6.1 but it is not compatible with current version of WordPress (can’t switch language for post on admin, etc…)

    After upgrade to 1.7.5 it creates a posts you described on your reply, but all strings have been imported in default English language, so we are not ready to use them. I wrote my own function which is loading data from old wp_options arrays and show right translations on front.

    I tried copy serialized arrays from wp_options to post_type “polylang_mo” but it works only for two from four languages we are using and after I changed one string on Settings > Languges > Strings translation it saves only 7 strings from cca 200 we are using on our website…

    Maybe if I downgrade plugin back to 1.6.1 and then upgrade to version where you change storing strings from wp_options to posts it will work, do you know in what version you made this change? Or please let me know if it is some easier way how to manage strings stored on wp_options table from admin dashboard.

    Thanks,
    Michal

    Plugin Author Chouby

    (@chouby)

    It looks like strings were stored on wp_options table in previous versions

    That’s right. In versions older than 1.2.
    The upgrade procedure does run only if your version was 1.2 or older.

    Here is the code:

    foreach(get_terms('language', array('hide_empty' => 0)) as $lang) {
    	if ($strings = get_option('polylang_mo'.$lang->term_id)) {
    		$mo = new PLL_MO();
    		foreach ($strings as $msg)
    			$mo->add_entry($mo->make_entry($msg[0], $msg[1]));
    		$mo->export_to_db($lang);
    	}
    }

    Thread Starter myso

    (@myso182)

    Hello Chouby,

    thanks for your reply!

    We have 4 languages on our site, after I run your script, it creates another 4 posts of “polylang_mo” type, so I have totally 8 posts there… I deleted all posts with post type = “polylang_mo”, then run your script and it looks like new posts have been successfully created and on database everything looks fine, there are all pairs of “string – translation”.

    https://www.pixhost.org/show/2089/27585212_polylang-db.jpg

    However, I am still not able to edit strings on Settings > Languages > Strings translation, all strings are still there on English.

    https://www.pixhost.org/show/2089/27585215_polylang-wpadmin.jpg

    Any ideas what is wrong? Is it problem that I changed IDs of posts?

    Thank you in advance for your reply.

    Michal

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Where are strings stored on database?’ is closed to new replies.