• It looks like

    get_option('my_option')

    returns on the front-end

    __( get_option('my_option') )

    i.e. on the front-end only, a call to get_option() returns the translated value.

    Example:
    if an option value is ‘[:en]New[:nl]Nieuw[:fr]Nouveau[:]’, get_option() returns ‘Nieuw’ when the language is set to nl.

    Question 1: Is my conclusion after two days troubleshooting correct?

    Question 2: Can this behaviour be turned off?

    Question 3: If the answer on Question 2 is ‘No’, could you please provide a get_option()-like function or method that returns the ‘raw’ option value?

    https://ww.wp.xz.cn/plugins/qtranslate-x/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author John Clause

    (@johnclause)

    Yes, front end gets everything translated to the current language. QTX is not yet designed to support multilingual values at front end. If you disable get_option translation, many things may get broken. However you may use option “Translation of options” on page “/wp-admin/options-general.php?page=qtranslate-x#advanced” to specify which options exactly you want to translate, other options will stay untranslated. This will probably work for you in whatever you do?

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    Well, I am the developer of plugin WP Photo ALbum Plus and have 779 option items. To speed up loading, they are not autoloaded but I use a serialized version of an array with options as ‘cached’ options.

    I perform an integrity check, and noticed that on almost every pageload the integrety of the cached version was corrupted, so the cached version has to be rebuilt. I use a lot of ajax calls, so it turned out to be as follows: the check failed at the first is_admin() load and then at the first !is_admin() load etc.

    As plugin developer I expect that get_option() returns the value I put in it. Using your translation of options option fixes it.

    At least i know now how it works, this will help me to find a better method.

    Thanx for your reply, and for the (almost) perfect plugin, that I recommend to be used to my users.
    Topic closed.

    Plugin Author John Clause

    (@johnclause)

    translating of options sometimes is the only way to get things translated, since not all developers follow the WP policies well enough. The original author simply translated them all. We added an option to control what to translate, and I guess it is working now in your case 😉
    Good luck in your development!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘get_option behaviour’ is closed to new replies.