Support » Plugin: Polylang » Polylang and Yoast SEO Plugin

Viewing 15 replies - 16 through 30 (of 38 total)
  • Plugin Author Chouby


    That’s really strange. All wpml-config.xml files are loaded in the same function. So I don’t understand why it works when the options are loaded from your theme child and not from you wordpress-seo directory…

    And it works on my test site…

    Could you try to modify the line 222 of polylang/include/wpml-compat.php from

    add_action('plugins_loaded', array(&$this, 'init'));


    add_action('plugins_loaded', array(&$this, 'init'), 1);

    Could you also try with only WordPress SEO + Polylang + a default theme such as Twenty Twelve. I would like to check if there could be interferences between two wpml-config.xml files

    I’ve deleted these lines from my wpml-config.xml file saved at child theme directory:

    <key name="wpseo_titles">
    			<key name="title-skill" />
    			<key name="title-category" />
    			<key name="title-post_tag" />
    			<key name="title-author" />
    			<key name="title-archive" />
    			<key name="title-search" />
    			<key name="title-404" />
    			<key name="title-ptarchive-project" />

    and replaced line 222 of polylang/include/wpml-compat.php

    Doesn’t work.

    Keeping the change at line 222 and adding those lines again at wpml-config.xml it get back to work.

    I’m not or ever been using more than one wpml-config.xml file, my first option, that I kept, was to place this file at child theme directory and not at polylang directory or theme directory to prevent the lost of the file on next polylang or theme update.

    Plugin Author Chouby


    I still did not reproduce the issue…

    WordPress SEO does use a wpml-config.xml file to ask for strings translations, just as you do with your child theme. So at least two files are read.

    And since, at the moment, I have no other explanation than some conflict between the two files, that’s why I asked you to test with a default theme without any wpml-config.xml file (so that only the one from WPSEO get read).

    Just in case, are you using the latest version of WPSEO?

    I’m using the latest version of WPSEO.

    I’ve performed the test as follow:

    I did remove wpml-config.xml from my child theme, switched to twenty twelve theme and all meta titles were working correctly. Then activated again my child Pitch Theme without wpml-config.xml and all meta titles from templates were working execept custom taxonomies that kept displaying at base language, Portuguese in my case.

    During the test with twenty twelve couldn’t see custom taxonomies meta titles working since they are part of Pitch Theme.

    I’ve moved again wpml-config.xml file to the child theme directory, but not before of delete all the keys from wpseo section with exception for the custom taxonomies, since the rest were currently working fine.

    Keys deleted:

    <key name="title-category" />
    <key name="title-post_tag" />
    <key name="title-author" />
    <key name="title-archive" />
    <key name="title-search" />
    <key name="title-404" />

    As I was testing it, all templates (404 not found, search, categories, tags and all custom taxonomies) started to show meta titles in Portuguese.

    It seems that your theory about the conflict between the two files is correct.

    For now the workaround is to repeat all wpseo keys at wpml-config.xml file at least for cases like mine where there are custom txonomies not handled for translation and let it override the default settings provided at Polylang admin settings.

    Plugin Author Chouby


    Thank you very much for your test. I will investigate in that direction.

    Plugin Author Chouby


    I created the simplest child theme of your theme pitch, took your wpml-config.xml, removed the WP SEO options. And unfortunately do not reproduced the same problem as you. I really don’t understand what can happen with your installation.

    Hi Chouby,

    Four months passed since this discussion. I’m starting a new site this time using suffusion theme. This site will also be multilingue and I’m facing again this same issue with wp-seo.

    When you made the test, did you change wp-config.php at language definition to define(‘lang’, ‘pt_PT’) ?

    Suddenly occurred to me that in a multilingue site this definition doesn’t make sense and might conflict with your plugin’s base language function.

    Plugin Author Chouby


    This should not conflict.

    Hi Chouby.

    I really appreciate the work you’ve done with this plugin. For now, I’ve been looking for a solution to a situation partially similar to the one indicated here. This is my information:

    1. My Polylang version is 1.1.4 (current).
    2. I deleted, reinstalled WordPress with all the plugins I’m currently using, then deleted and reinstalled Polylang, and I still have the same issue.
    3. My permalink settings are
    4. I’m not using a static front page
    5. My Polylang settings are:
    a) Language set according to browser preference
    b) The language code is added to all urls
    c) Remove /language/ in pretty permalinks
    d) Activate languages and translations for all types.
    6. My child theme is Twenty Twelve Dark, which is referenced to the Twenty Twelve WordPress standard theme.

    The plugins that create conflicts are both the Yoast SEO and the WP e-Commerce plugins.
    My website is bilingual (English/Spanish), using English as standard.
    In my case, define(‘lang’,’ ‘), as the WordPress standard installation sets.

    Even though the wpml-config.xml file exists at the Yoast SEO folder, I don’t see their strings at the Polylang’s Strings translation tab.
    So, based on miguelcortereal comments, I created a wpml-config.xml file and then I placed it into my child theme folder, and later into the WP e-commerce folder, just to test further.

    In both cases, the Polylang’s Strings translation tab were populated with both the Yoast SEO and the WP e-Commerce strings, and in both cases, the Group column either showed the child theme name or the WP e-Commerce plugin name.

    Here are the contents of my xml file:

            <key name="product_list_url" />
            <key name="shopping_cart_url" />
            <key name="checkout_url" />
            <key name="transact_url" />
            <key name="user_account_url" />
            <key name="wpseo_titles">
                <key name="title-home" />
                <key name="metadesc-home" />
                <key name="metakey-home" />
                <key name="title-post" />
                <key name="metadesc-post" />
                <key name="metakey-post" />
                <key name="title-page" />
                <key name="metadesc-page" />
                <key name="metakey-page" />
                <key name="title-attachment" />
                <key name="metadesc-attachment" />
                <key name="metakey-attachment" />
                <key name="title-category" />
                <key name="metadesc-category" />
                <key name="metakey-category" />
                <key name="title-post_tag" />
                <key name="metadesc-post_tag" />
                <key name="metakey-post_tag" />
                <key name="title-author" />
                <key name="metadesc-author" />
                <key name="metakey-author" />
                <key name="title-archive" />
                <key name="metadesc-archive" />
                <key name="title-search" />
                <key name="title-404" />

    In my case, my problem is that the WP e-Commerce theme works centered around the Products Page. The wp_options table shows the product_list_url value as

    So, if I put the xml file into either of the 2 locations indicated before, and then I change the Polylang Spanish product_list_url string translation to as the permalink for the page in Spanish indicates, and then I try to navigate there, no problem happens.

    But, if I click on “more details” at the grid view for the product currently displayed, then I get the 404 error, which is now titled in Spanish Página no encontrada, instead of Page not Found, because I translated the title-404 Yoast SEO entry at the Strings translation tab, with the xml file located at either the child them or the WP e-Commerce folders.

    If I do all these operations selecting the English language, I don’t have any 404 problems. It seems to me that this happens because the product_list_url at the wp_options table is already in English and it’s not being translated.

    If I erase the new xml file and I try to click the “more details” link while on grid view for the product being displayed, my website navigates towards<category in Spanish>/<post title in Spanish>/, without giving me the 404 error.

    The odd thing is that the Products Page part of the permalink never translates. It stays in English.

    I checked the wpsc-functions.php for the WP e-Commerce plugin and found these functions related to the Products Page

    function wpsc_get_page_post_names() {
    	$wpsc_page['products']            = basename( get_option( 'product_list_url' ) );
    	$wpsc_page['checkout']            = basename( get_option( 'checkout_url' ) );
    	$wpsc_page['transaction_results'] = basename( get_option( 'transact_url' ) );
    	$wpsc_page['userlog']             = basename( get_option( 'user_account_url' ) );
    	return $wpsc_page;
    function wpsc_add_https_to_page_url_options( $url ) {
    	return str_replace( 'http://', 'https://', $url );
    if ( is_ssl() ) {
    	add_filter( 'option_product_list_url',  'wpsc_add_https_to_page_url_options' );
    	add_filter( 'option_shopping_cart_url', 'wpsc_add_https_to_page_url_options' );
    	add_filter( 'option_transact_url',      'wpsc_add_https_to_page_url_options' );
    	add_filter( 'option_user_account_url',  'wpsc_add_https_to_page_url_options' );
    function wpsc_update_permalink_slugs() {
    	global $wpdb;
    	$wpsc_pageurl_option = array(
    		'product_list_url'  => '[productspage]',
    		'shopping_cart_url' => '[shoppingcart]',
    		'checkout_url'      => '[shoppingcart]',
    		'transact_url'      => '[transactionresults]',
    		'user_account_url'  => '[userlog]'
    	$ids = array();
    	foreach ( $wpsc_pageurl_option as $option_key => $page_string ) {
    		$id = $wpdb->get_var( "SELECT <code>ID</code> FROM <code>{$wpdb->posts}</code> WHERE <code>post_type</code> = 'page' AND <code>post_content</code> LIKE '%$page_string%' LIMIT 1" );
    		if ( ! $id )
    		$ids[$page_string] = $id;
    		$the_new_link = get_page_link( $id );
    		if ( stristr( get_option( $option_key ), "https://" ) )
    			$the_new_link = str_replace( 'http://', "https://", $the_new_link );
    		if ( $option_key == 'shopping_cart_url' )
    			update_option( 'checkout_url', $the_new_link );
    		update_option( $option_key, $the_new_link );
    	update_option( 'wpsc_shortcode_page_ids', $ids );

    these other 2 files of the WP e-Commerce plugin include the product_list_url too. The shopping cart, transaction results and user account pages create the same problem, but I’m not using them for now.


    What I’m looking for is to present the Product Page permalink part in Spanish when Spanish is selected or in English if English is selected and avoid the 404 error. On the other hand, it seems odd to me that the wpml-config.xml file located at the Yoast SEO folder is not included at the Strings translation tab until I copy it into my child theme folder or the WP e-Commerce folder, and even then, the WP e-Commerce plugin tries to load the English permalink for the Products page, as it is in the wp_options table and generates 404 errors if it tries to load the translated permalink.

    What do you recommend me to do?

    My website is, if you have a chance to navigate and see the Products Page permalink part always in English, when you select Spanish and right after you click at the Pagina de Productos Menu. Just hover your mouse over the “Mas Detalles” link and you’ll see.

    I only listed one product, in case I have to redo the website installation and configuration again.

    If you require any additional information, please don’t hesitate to ask. Thank you in advance.

    You’re right Chouby, that define( ‘wplang’, ” ) doesn’t conflict.

    However, I reasure you that for me yoast wpseo strings only get to working by replicating them at a wpml-config.xml file.

    I’ve tested it with and without the file and it works with but doesn’t without.

    This time the issue was at Archives meta titles, the other strings looked to be fine.

    There was a strange behaviour too that caught my attention, when I placed the wpml-config.xml file at my theme’s child theme folder, it didn’t start to work imediatly, so after playing a bit with polylang definitions such as browser language detection, URL modifications options and permalink update because of the URL with or without /language/ and eventually re-save some of the posts tags and categories, my meta titles got working for each language.

    I had to switch the setting “The language code is added to all urls” to “The language is set from content” because I started getting 404 errors all over the place and could only get to the Home page without getting 404s.

    Switching this option removes the language code, but “solves” my 404 problem. I guess that since I didn’t flush the cache (I’m using WP Super Cache), I worked for a while with a previous setting I had (language set from content).

    Regarding wpml-config.xml, miguelcortereal is right. The wpml-config.xml file is not being included at the Strings translation tab, until you copy it to another plugin folder.

    Plugin Author Chouby


    Yes I am aware that this is a “not solved” issue. Polylang is looking for all wpml-config.xml files in the directory of all active plugins. I don’t understand what could be specific to wordpress-seo plugin.

    When I make test at home, everything works as expected. I just remade a test with latests versions of WP, WPSEO and Polylang.

    Please note however that strings intentionnally don’t appear in strings translations table if they are left empty in plugins settings.

    This is just a thought, but I’ve noticed that on last Yoast Seo Plugin update, there was a fix related with strings reported at changelog.

    Who knows if the problem is at Seo Plugin ?

    My WordPress website broke with 404s all over the place, so I reinstalled WordPress, again, yesterday morning. I decided to install only the plugins that I deemed absolutely necessary and let the more complex ones (e.g. WP Super Cache) at their default settings, without customization.

    My website it’s been working fine for a while now (it was taking less than 4 hours to brake as I customized it before), so my guess is that certain custom settings from WP Super Cache (maybe the use of mod_rewrite instead of PHP to serve cached files) or Better WP Security (I didn’t install it this time) might be causing the Polylang plugin or the whole WordPress installation to brake.

    It’s working fine using the language code (/en/ or /es/) added to all urls when using pretty permalinks, as it is your recommended setting when using Yoast SEO. The permalink part for the WP e-Commerce pages titles switch to English, when containing a post, but that’s something that I can live with.

    I’ve set up a localhost mirror copy of my website in my mac, using it’s native Apache and PHP installations, and I’ve been going through it with Netbeans, but it takes a lot of time to debug a system so big and complex, and sometimes time is limited.

    That’s why, Chouby, I totally understand and respect the work you’ve been doing with the Polylang plugin. We just hope that you get the time to fix these situations at a later release.

    Thank you, Chouby!

    I want share my problem and solution.
    Today i’ve discovered that my meta description and all other SEO string were not changing with the language of the page.
    They were set correctly, polylang was able to get them with a manually test (ex: pll__(__(‘test var’)).
    So wpml-compat.php line 362 was doing all correctly.

    I’m gone to check if the problem was SEO by Yoast and apparently i was a bit confused because testing class-frontend.php and checking get_wpseo_options() and metadesc() the array was in the default language and for no reason was the right language.. anyway…to make a long story short i’ve set in polylangs->settings->url modifications->”The language code, for example /en/, is added to all urls when using pretty permalinks.” than i’ve re-saved in settings->permalinks and all was working good.

    While i was finishing this post i’ve checked for the 1000 times the documentation of polylang and i’ve found this sentence “For example, it is recommended to use the second option when running Polylang together with WordPress SEO by Yoast.”

    In my humble opinion it’s better add this thing to the FAQ:
    I’ve installed SEO by Yoast but the custom strings are not working properly
    Answer with the solution above.

    I hope this will save someone. ^^
    As usual sorry for my English.

    I’ve added here this post because is similar to this thread and this other old thread

Viewing 15 replies - 16 through 30 (of 38 total)
  • The topic ‘Polylang and Yoast SEO Plugin’ is closed to new replies.