Unable to translate one custom post type slug in WPML Unable to translate one custom post type slug in WPML wordpress wordpress

Unable to translate one custom post type slug in WPML


Try this

    add_action( 'init', 'create_post_type');    function create_post_type() {        $labels = array(        'name'               => _x( 'Products', 'general name of the post type' ),        'singular_name'      => _x( 'Products', 'name for one object of this post type' ),       );       $args = array(         'labels' =>  $labels, // An array that defines the different labels assigned to the custom post type         'public' =>  true, // To show the custom post type on the WordPress dashboard         'supports' => array( 'title', 'thumbnail', 'page-attributes' ),         'has_archive' =>  true, //Enables the custom post type archive at          'hierarchical' =>  true, //Enables the custom post type to have a hierarchy         'rewrite' => array( _x('slug' => 'products'), 'with_front' => false ),    );    register_post_type( 'products', $args );    }


Have you flushed the rewrite rules?

Go to Settings > Permalinks and refresh.

Note: If registering a post type inside of a plugin, call flush_rewrite_rules() in your activation and deactivation hook (see Flushing Rewrite on Activation below). If flush_rewrite_rules() is not used, then you will have to manually go to Settings > Permalinks and refresh your permalink structure before your custom post type will show the correct structure.

source: https://codex.wordpress.org/Function_Reference/register_post_type