This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by Andre Koebel und 3 months, 2 weeks ago.

Assigned support staff: Rohan Sadanandan.

Author Posts
July 2, 2019 at 10:17 am #4125641

Andre Koebel und

Hey,

we are using wpml_active_languages to create a custom language switcher. At the moment the function returns "translations" for posts/pages who are not translated yet.

Example:

hidden link

$languages = apply_filters( 'wpml_active_languages', NULL, array( 'skip_missing' => 1 ) );

The language Switcher returns

Array
(
[de] => Array
(
[code] => de
[id] => 3
[native_name] => Deutsch
[major] => 1
[active] => 1
[default_locale] => de_DE
[encode_url] => 0
[tag] => de
[missing] => 0
[translated_name] => Deutsch
[url] => hidden link
[country_flag_url] => hidden link
[language_code] => de
)

[en] => Array
(
[code] => en
[id] => 1
[native_name] => English
[major] => 1
[active] => 0
[default_locale] => en_US
[encode_url] => 0
[tag] => en
[missing] => 1
[translated_name] => Englisch
[url] => hidden link
[country_flag_url] => hidden link
[language_code] => en
)

)

But the english Version does not exists. hidden link shows the german Version, but why? It needs to redirect to the home page.

The htaccess Login data are:

U: superuser
P: Berl1n!!

July 2, 2019 at 10:39 am #4125813

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

According to Debug information you provided:

   [custom_posts_sync_option] => Array
                (
                    [post] => 1
                    [page] => 2
                    [attachment] => 1
                    [custom_css] => 0
                    [customize_changeset] => 0
                    [oembed_cache] => 0
                    [user_request] => 0
                    [acf-field-group] => 0
                    [wpcf7_contact_form] => 0
                    [casino] => 1
                    [sidebar] => 0
                    [wp_block] => 1
                    [game] => 1
                )

This would mean the following - WPML -> Settings -> Post Types Translation -> Pages is set to "Translatable - use translation if available or fallback to default language" (the value of "2" would indicate this). This is in fact this option:
https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/

Can you set for both posts and pages to be "Translatable - only show translated items"? Is the issue still there?

Regards,
Bruno Kos

July 2, 2019 at 11:27 am #4126335

Andre Koebel und

My issue is resolved now. Thank you!