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 thread is resolved. Here is a description of the problem and solution.

Problem: Need to exclude media translation in custom post types Solution: WPML > Settings > Post Type Translation > Unlock the "Media" Post type > set it to "Translatable - use translation if available or fallback to default language".

This topic contains 6 replies, has 2 voices.

Last updated by rebeccaD 3 months ago.

Assigned support staff: Bruno Kos.

Author Posts
July 17, 2019 at 6:56 pm #4233035

rebeccaD

Hi - I tried to post this a few minutes ago but it got changed to "Closed" without a single reply, so I'm trying again:

I have a site with a large amount of data indexed by custom post types (CPTs). Some CPTs have media attachments values as part of the post type. When I originally installed WPML, I installed the Media Translation plugin but had so much trouble with it that I decided to restore my site from a backup, and reinstall WPML *without* including the media translation.

Also, because I have a child theme (Divi is the parent theme), I included my own wpml-config.xml file with lines to specifically NOT translate any of my CPTs. Here are the lines I inserted:

<custom-types>
    <custom-type translate="0">book_of_the_bible</custom-type>
    <custom-type translate="0">composer</custom-type>
    <custom-type translate="0">feast_day</custom-type>
    <custom-type translate="0">homily</custom-type>
    <custom-type translate="0">language</custom-type>
    <custom-type translate="0">mass_setting</custom-type>
    <custom-type translate="0">publisher</custom-type>
    <custom-type translate="0">reading_type</custom-type>
    <custom-type translate="0">reading</custom-type>
    <custom-type translate="0">song_theme</custom-type>
    <custom-type translate="0">tmps_song_type</custom-type>
    <custom-type translate="0">tmps_song</custom-type>
</custom-types>

When I enabled and configured WPML and tried to access an image attached to the feast_day CPT (as defined in the "do not translate" list in my wpml-config.xml file), the image src is still blank when not in the default language (English).

You can see examples of the image being displayed in default/English here:
hidden link

And the image *not* being displayed when the secondary language (Spanish) is displayed here:
hidden link

(Note: I *know* that the English translation is *really* a bilingual page but that is by design for now.)

Also, there are different page templates for the default English/bilingual display verses the Spanish display, *however* the calls in the php template to load the image file are the same in both - it's just that the "Spanish" version doesn't get the image that was originally assigned to the CPT.

I don't want *any* images translated *except* the logo. I've learned that the very few remaining locations where I will want them translated, I can handle that manually. 99% of my images have no strings. I *really* just want *every* aspect of my CPTs to be *completely* left alone by WPML. That way I can really use all the great functionality that WPML provides without the over-complication that I don't need.

Here are my settings (that may be useful):
1. I have *only* translated one page so far to keep it simple right now. I haven't even tried to translate the logo or menu. I need to make sure it will work as desired (*and* specified in the xml file) before I spend any more time on other pages.
2. Synchronize page template is UNCHECKED
3. Translate custom post and taxonomy base slugs (via WPML String Translation) is UNCHECKED
4. ALL "Custom Fields Translation" are set to "Don't Translate"
5. ALL "Custom Term Meta Translation" are set to "Don't Translate"
6. ALL CPTs in the "Post Types Translation" section are set to "Not translatable"
7. ALL Custom Taxonomies in the "Taxonomies Translation" section are set to "Not translatable"
8. *Every* time I load this settings page, the following options are CHECKED *even though* I uncheck them and click "Apply" every time I load the page:
Translate existing media in all languages
Duplicate existing media for translated content
Duplicate the featured images for translated content
9. "When uploading media to the Media library, make it available in all languages" is CHECKED

Any help you can provide to fix this problem is greatly appreciated.

July 18, 2019 at 7:05 am #4235521

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

8. *Every* time I load this settings page, the following options are CHECKED *even though* I uncheck them and click "Apply" every time I load the page:
Translate existing media in all languages
Duplicate existing media for translated content
Duplicate the featured images for translated content

Can you tell me if you are referring to these settings?
https://wpml.org/documentation/getting-started-guide/media-translation/#media-translation-settings

When you click "apply", do you see something like "Started...", which then disappears after second or two, along with the spinning wheel? Also, it will be expected that you see no errors in the chrome console log, such as admin-ajax 500 or some JavaScript errors.

Regards,
Bruno Kos

July 18, 2019 at 2:02 pm #4239481

rebeccaD

Yes, that is correct. That is exactly the settings I’m referring to and the screenshots illustrate exactly what’s happening, with the exception that all those items are unchecked for me. No console errors.
When I reload the page, everything I unchecked is checked again.
Please tell me how to make this thing stop translating media. Thank you!

July 18, 2019 at 2:20 pm #4239559

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

Can you please check if this issue (MT not saving settings) appears when:

- only WPML plugins are activated, as it will tell us if there is an interaction issue with other plugin
- theme is set to a WordPress default like Twenty Nineteen as it will tell us if there is an interaction issue with your theme

If it is still not working, can you try getting some debug information like this:

1. Edit wp-config.php and insert the following lines:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

2. Reproduce the issue - save MT settings.

3. Locate the debug log in: /wp-content/debug.log

4. Paste the latest lines here. No need to paste the entire log file, just 10 lines or so will do. Please censor any sensitive information.

https://codex.wordpress.org/Debugging_in_WordPress

Regards,
Bruno Kos

July 18, 2019 at 6:09 pm #4241695

rebeccaD

I tried disabling all but the WPML plugins and it still doesn't save the settings.
Note that I DO NOT have the WPML Media Translator plugin installed at all.
I didn't switch to the 2019 theme because that would disable my page template, obviously.

However, I did turn debugging on but apparently there are no errors because it hasn't even created the file. No matter how many times I reload WPML Settings (and subsequently find that of my settings regarding Media translation has NOT been saved), and try to uncheck them and hit Apply, I still see the same "Starting..." and then nothing...

I even edited the wpml-config.xml file within wp-content/plugins/sitepress-multilingual-cms and set ANYTHING that had to do with images to either "ignore" or translate="0" and deactivated the plugins and reactivated the plugin and it is STILL translating the images.

I even edited one of my CPTs, deleted the image associated with it, then uploaded a BRAND NEW image and saved the CPT. And WPML is *still* translating the image and not just giving me the default/English version. Every other aspect of the CPT is being left alone except the image.

Is this just how WPML always works? Is there any way whatsoever to prevent it from translating images? Because it seems to me that the plugin is completely ignoring my preferences.

Thank you

July 19, 2019 at 7:11 am #4244381

Bruno Kos
Supporter

Languages: English (English )

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

Hi,

How about this?

WPML > Settings > Post Type Translation > Unlock the "Media" Post type > set it to "Translatable - use translation if available or fallback to default language".

Or try to install MT plugin and try disabling the settings then?

Regards,
Bruno Kos

July 19, 2019 at 4:54 pm #4247573

rebeccaD

Hi Bruno,

So I finally got it working and here's how. First, I restored my backup of the wpml-config.xml file, then I unlocked the Media translation and set it to "Translatable - use translation if available or fallback to default language" as you suggested but that didn't work.

I installed the WPML Media plugin and tried to save the settings and that didn't work either. However, you gave me an idea with the "Post Types Translation" - so I went back there and set the Media type to "Not translatable" and that worked! And I was able to deactivate the Media translator plugin as well and it's still working!

Because the Media post type had a "lock" on it, I kept overlooking it. Anyway, I'm super excited that it's working now. I had a "workaround" that I could use but it would cause more headache for the data entry people and I'm trying to make this easy to use.

Thank you Bruno!