WPML is one of the biggest solutions to create 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. We even ended up using the plugin ourselves when translating wpadvancedads.com into German and became a certified WPML partner.
- 1 In a nutshell
- 2 Translating ads?
- 3 How to enable translations for ads
- 4 The behavior of translated ads
- 5 Specifics of untranslated ads
- 6 Using display conditions with WPML
- 7 Translating ad groups – the best choice
- 8 Other options are untranslated
- 9 The WPML language condition
- 10 Translating the Ad Label option
- 11 Known issues
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
- Options and placements are not language-specific. It is best to use the All languages option when editing them
- Advanced Ads Pro comes with a WPML display condition to show ads by selected language
With Advanced Ads and WPML combined, you have multiple options to handle ads. You can manage ads for each language, you can use the same ads for both versions, or just 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 who don’t have to worry about translations because AdSense is delivering the content of the ad based on the visitor automatically.
Please find the options you have (not) translating your ads managed with Advanced Ads and WPML below.
How to enable translations for ads
By default, WPML does not add their translation interface to ad edit pages. This means that you will always have access to your full 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 your WPML settings. In your WordPress dashboard, go to 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 second 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.
The behavior of translated ads
If you are familiar with how WPML translates posts and pages then you already know how translating ads feels like. Once you create a new ad, it will automatically be bound to the language version in which you created 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 linked from the ad list already.
Specifics of untranslated ads
I noticed a few things about untranslated ads that are worth mentioning.
Ads are only editable in the default language of the site. E.g., when you are on the ad edit page in the default language and switch to another language in the backend, the ad edit screen is going blank. When you save that screen, a completely new ad is created and also only editable in the default language.
Using display conditions with WPML
Whether you are using translated ads or not, Display Conditions will always be site specific.
Let’s 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 be able to find the page with the language you are using your backend in.
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.
With ads being translatable, 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 – the best choice
WPML also 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.
When you enable translations for groups, you will be able to assign different ads per language to them. It doesn’t matter whether you have ads translated for this or not.
As far as I 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.
Other options are untranslated
Aside from ads and ad groups, no other option is translated with WPML, including placements. This means that you will have the same placements set up for all languages. If you assign a translated ad to a placement, it will not output the other translated ad automatically in the frontend. You should use an ad group as described above, too.
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 certain translations of the site.
E.g., Your “Buy Now” ad is using the Before Content placement, but you only want to inject it into English sites and not the German one.
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
When switching the language in the backend, some options disappear. Use the “all languages” option if you work on 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 in order to save ad weights.
Redis Object Cache
The translation doesn’t seem to work when the Redis is used on the server and 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') );