• In wp-content/plugins/google-sitemap-generator/class-googlesitemapgeneratorstandardbuilder.php, build_posts(), a patch was added trying to fix permalinks with secondary languages in WPML. Everything related to $siteLanguages array.

    Our website, have a lot of custom permalink filters, and google-sitemap-generator patch results in invalid URL listing. The post slug is at the begging and the end of the permalink for all secondary language content.

    Since all our permalinks are already valid in english (primary) and french (secondary), i’ve added a $patchUrlLanguage (false) condition around both function_exists icl_get_languages/pll_the_languages so that $siteLanguages remains empty.

    Maybe a plugin option or a plugin filter could help to activate/deactivate the secondary languages URL patching.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Auctollo

    (@auctollo)

    Do you have some example filters that you’re applying?

    Thread Starter yanmorinokamca

    (@yanmorinokamca)

    \add_filter('post_type_link', [$this, 'filterCustomPermalinkSlug'], 10, 4);

    Where filterCustomPermalinkSlug add cache, handle $leavename (3rd argument), get the post type language and works with more than 10 different post types (by adding sub-categories for some post type or different prefix). It rewrites them from scratch. The function doesn’t handle “page/post” post type, but they both work as is with wpml default rewriting.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WPML url patching break valid permalinks’ is closed to new replies.