I'm using WPML plugin to translate my site. I have a custom post type called "vinos" and I use this args:

$args = array( 
            'labels' => $labels,
            'hierarchical' => false,
            'supports' => array('title', 'thumbnail'),
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'menu_position' => 6,
            'show_in_nav_menus' => true,
            'publicly_queryable' => true,
            'exclude_from_search' => false,
            'has_archive' => 'nuestros-vinos/catalogo',
            'query_var' => true,
            'can_export' => true,
            'capability_type' => 'post',
            'rewrite' => array('slug' => 'nuestros-vinos/catalogo/marcas/%marcas%')
    register_post_type('vinos', $args);

The problem is that I can't translate my string "nuestros-vinos/catalogo/marcas" to english and for that reason my urls are:

www.domain.com/nuestros-vinos/catalogo/ ---------> show all my list of wines in spanish www.domain.com/en/nuestros-vinos/catalogo/ ------> show all my list of wines in english

but I would like that in english version, the url was:


I'm trying to use rewrite rules:

add_filter('generate_rewrite_rules', 'customposttype_rewrites');
function customposttype_rewrites($wp_rewrite) {
    $newrules = array();
    $newrules['en/our-wines/catalog/?$'] = 'en/index.php?post_type=vinos';
    $wp_rewrite->rules = $newrules + $wp_rewrite->rules;

But it doesn't work, always page not found.

How can I do it?


  • possible duplicate of Internationalize / translate custom post types & taxonomies
    – s_ha_dum
    Commented Jun 14, 2013 at 15:27
  • It doesn't work.
    – Mike
    Commented Jun 14, 2013 at 15:29
  • Have you tried that with 'has_archive' => true instead of naming the archive explictly?
    – s_ha_dum
    Commented Jun 14, 2013 at 15:35
  • Have you tried the relative new feature of WPML 2.8.2 that now lets you translate custom post type slugs? This feature is still in beta, but it might work...
    – user2015
    Commented Jun 24, 2013 at 5:23

2 Answers 2


this will not work:


there is no en/index.php, it has to be:


if you need to detect en in the path, add a query var, then set that query var in your rewrite:

function wpa_query_vars( $qvars ) {
    $qvars[] = 'wpa_lang';
    return $qvars;
add_filter( 'query_vars', 'wpa_query_vars' );

then in your rewrite rule:

$newrules['en/our-wines/catalog/?$'] = 'index.php?post_type=vinos&wpa_lang=en';

Try the solution mentioned here: http://wpengineer.com/2044/custom-post-type-and-permalink/ which basically entails re-saving your permalink settings once again.

Example: set permalinks to default structure, save. Switch to your desired permalink structure, save again and then check again if your custom post permalink issue persists.

I have had 404 issues in the past with custom post permalinks and the solution mentioned above worked for me.

Edit: Also, hopefully you don't have enabled any caching plugins while you are coding, just forgot to mention this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.