Custom Post Type slug and WPML gets 404 error

My solution is for a WordPress Installation (Version 5.2.2), for translation is only WPML Multilingual CMS (Version 4.2.7.1) installed. The modules WPML String Translation (which is very performance-consuming) and WPML Translation Management are not required. I’m using this WPML url structure: www.url.com/en/postname. My Custom Post Type should have the slug “produkte” in German, “products” in … Read more

add .html to custom post type with WPML

Aleluhia ! it was because $type don’t use WPML function Here is the code that works perfectly with WPML and translated slug : // .html pour les customs posts function rewrite_rules($rules) { $new_rules = array(); foreach (get_post_types() as $t) $new_rules[$t . ‘/(.+?)\.html$’] = ‘index.php?post_type=” . $t . “&name=$matches[1]’; return $new_rules + $rules; } add_action(‘rewrite_rules_array’, ‘rewrite_rules’); … Read more