WPML is one of the most prominent solutions for creating multilingual WordPress sites. It is so popular among our users that I decided to dive into its features to see how ads work on multilingual sites.
Table of Contents
In a nutshell
- By default, ads and ad groups are set to non-translatable by WPML. You can make them translatable like any other post type or taxonomy.
- Display conditions on the ad edit screen show the information for the selected language.
- Plugin options are not language-specific. It is best to use the All languages option when editing them.
- The Placements page shows the ads and groups depending on the language. An ad selected in one language will automatically cause the correct translated version to show in the other languages, too.
- Advanced Ads Pro comes with a WPML display condition to show ads by selected language.
Translating ads?
With Advanced Ads and WPML combined, you have multiple options to handle ads. You can manage ads for each language, use the same ads for both versions, or handle a few ads with translations, but not others.
Here are a few scenarios when it makes sense to have different ads per language:
- Your ad content or image contains text that only makes sense in one language but not the other.
- You want to track the performance of an ad per language.
- You want different target URLs per language.
- Using display conditions based on translated content, e.g., Specific Pages.
I have seen all of these scenarios implemented by our users.
Not everyone with a translated website needs different ads per language, though. I have also seen many publishers using ad networks like AdSense. They don’t have to worry about translations because AdSense automatically delivers the ad’s content based on the visitor.
Please find below the options you have (not) translating your ads managed with Advanced Ads and WPML.
How to enable translations for ads
By default, WPML does not add its translation interface to ad edit pages. This means that you will always have access to your complete ad list in the frontend and backend, regardless of the language you are currently switched to.
I have seen this default behavior to be different in older WPML installations and translating ads by default.
You can enable translations for ads in one of two sections:
- WPML > Settings > Post Types Translation and look for the row starting with Ads (advanced_ads).
As mentioned, the selected option in this line should be Not translatable by default, the right column in the table.
To set ads to being translatable you need to change the option to “Translatable – only show translated items”, like on the screenshot below.
The option – “Translatable – use translation if available or fallback to default language” – does not differ from the translation option right now, and you can just ignore it.
- You can also make ads translatable through the “Multilingual Content Setup” box on the ad edit screen.
The behavior of translated ads
If you are familiar with how WPML translates posts and pages, you already know what translating ads feels like. Once you create a new ad, it will automatically be bound to the language version you made it. You can create translated versions as well through the WPML options, which are then magically attached.
It is best to see on the ad list and when switching between the language versions of your site. As you can see below, my English site has two ads, with “Ad – English” having a German equivalent already linked from the ad list.
Please note that the image assigned to an image ad is not automatically translated. You must select the correct image of the newly translated ad from the media library again.
Using display conditions with WPML
Whether you are using translated ads or not, Display Conditions will always be language-specific.
Imagine you have an English landing page called “About Us”, and a German translated version called “Über Uns”. You want to display a specific ad on these pages.
When you go to the ad edit page and add the Specific Pages Display Condition, you will only find the page with the language you are using your backend in.
Non-Translatable ads
With English being the default language and the ad set to be untranslated, you will never be able to display it based on a display condition from the German site, like on the “Über Uns” page only.
Translatable ads
With translatable ads, you can choose the “About Us” page for the English ad and “Über Uns” for the German translation.
You will need to set these conditions for both ads. They are not “translated” automatically.
The same applies to most other conditions and options, like visitor conditions or tracking.
Translating ad groups
WPML allows translating ad groups. This feature is also disabled by default. You can enable this in WPML > Settings > Taxonomies Translation. Look for the Ad Groups & Rotations (advanced_ads_groups) row.
You also need to match the translated groups of the different languages in WPML > Taxonomies Translation.
The Groups page only shows ads for the current language. E.g., you select an English ad while editing the group for English. Now you switch to German. If the previous English ad is connected to a German translation, the German ad will appear in the group.
If there is no German translation, the German won’t show it in the backend and frontend.
As far as we see it, assigning your ads, translated or not, to translated groups seems the best option to deliver ads based on the language. You can use that group in a placement or add it directly to your site in a widget or using the shortcode.
Translating placements
The Placements page shows the same placements for all languages.
Only ads and groups for the current language appear in the Item field. E.g., you select an English ad while editing the placements for English. Now you switch to German. If the previous English ad is connected to a German translation, then the German ad will show up as the Item. If there is no German translation, the Item field will stay empty.
When you assign a translated ad or group in any language, the translated version of that ad will show up in the frontend for the correct version of the site.
Advanced Ads Pro also offers the option to add display and visitor conditions to placements. So you could use the WPML display condition to assign your placements to specific languages.
Edit untranslated options in “all languages” view
As general advice, you should edit untranslated ads, untranslated groups, and other options and pages in Advanced Ads in the “all languages” view in your backend.
Otherwise, we have seen some information getting lost when changing the backend language.
The WPML language condition
Advanced Ads Pro comes with a WPML language display condition. This option comes in handy when you want to display an untranslated ad in a general position, like a widget or through a placement, and limit it to specific translations of the site.
E.g., Your “Buy Now” ad uses the Before Content placement, but you only want to inject it into English sites and not the German ones.
Translating the Ad Label option
You can translate the Ad Label option under Advanced Ads > Settings > General using the String Translation plugin by WPML.
- Enable the WPML String Translation plugin.
- Go to WPML > String Translation.
- Select admin_texts_advanced-ads in the domain filter.
- Click on the translations link in the String column.
- Enter the translations and mark them as complete.
Known issues
When switching the language in the backend, some options disappear.
Use the “all languages” option if you work on untranslatable ads, groups, or other Advanced Ads-related pages to not run into this problem.
A user reported that he had to set the ad group taxonomy to “translatable” in the “Multilanguage Settings” panel inside the ad edit page to save ad weights.
Redis Object Cache
The translation doesn’t seem to work when Redis is used on the server and the Redis Object Cache plugin is enabled.
The solution is to add Advanced Ads as an exception to Redis by adding the following line into your wp-config.php
:
define( 'WP_REDIS_IGNORED_GROUPS', array('advanced-ads') );
Code language: PHP (php)