Skip Navigation

Resolved

Resolved in: 4.4.0

Overview of the issue

When you set the language URL format to be Different languages in directories, the sitemaps created by Google XML Sitemaps plugin will have wrong URL for the translated posts and pages.

Workaround

We’re working on a permanent fix for this issue. In the meantime you can use the following workaround:

– Backup your website database and files.
– Add the following code snippet to your theme’s functions.php file:

if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
    add_filter( 'option_sm_options', 'sm_wpml_exclude' );
}
function sm_wpml_exclude( $value ) {
    global $wpdb;

    $ids = $wpdb->get_col( $wpdb->prepare(
        "SELECT element_id FROM {$wpdb->prefix}icl_translations"
        . " WHERE element_type LIKE 'post_%%' AND language_code <> '%s'",
        ICL_LANGUAGE_CODE
    ) );
    $value['sm_b_exclude'] = $ids;

    return $value;
}