[Closed] Custom Taxonomy Slug not translating

Home Support English Support [Closed] Custom Taxonomy Slug not translating

This topic contains 7 replies, has 3 voices, and was last updated by  sarah.n 10 months ago. The support staff assigned to this topic is sarah.n.

Viewing 8 posts - 1 through 8 (of 8 total)
Author Posts
Author Posts
September 23, 2013 at 5:06 pm #267871

Tom

Hello, I searched through the forums and the documentation but I am still not sure how to get this slug translated.

Translate custom posts slugs (via WPML String Translation) – checked
Custom taxonomies: Categories – set to translate (the name of the taxonomy is Categories just in the UI)
Translate by WPML – selected
Resaved permalinks – preformed
Save options and rescan strings – preformed

add_action( 'init', 'register_taxonomy_gallerycat' );

function register_taxonomy_gallerycat() {

    $labels = array( 
        'name' => _x( 'Categories', 'gallerycat' ),
        'singular_name' => _x( 'Category', 'gallerycat' ),
        'search_items' => _x( 'Search Categories', 'gallerycat' ),
        'popular_items' => _x( 'Popular Categories', 'gallerycat' ),
        'all_items' => _x( 'All Categories', 'gallerycat' ),
        'parent_item' => _x( 'Parent Category', 'gallerycat' ),
        'parent_item_colon' => _x( 'Parent Category:', 'gallerycat' ),
        'edit_item' => _x( 'Edit Category', 'gallerycat' ),
        'update_item' => _x( 'Update Category', 'gallerycat' ),
        'add_new_item' => _x( 'Add New Category', 'gallerycat' ),
        'new_item_name' => _x( 'New Category', 'gallerycat' ),
        'separate_items_with_commas' => _x( 'Separate categories with commas', 'gallerycat' ),
        'add_or_remove_items' => _x( 'Add or remove categories', 'gallerycat' ),
        'choose_from_most_used' => _x( 'Choose from the most used categories', 'gallerycat' ),
        'menu_name' => _x( 'Categories', 'gallerycat' ),
    );

    $args = array( 
        'labels' => $labels,
        'public' => true,
        'show_in_nav_menus' => true,
        'show_ui' => true,
        'show_tagcloud' => true,
        'show_admin_column' => false,
        'hierarchical' => true,
        'rewrite' => array('slug' => 'before-and-after-pictures' ),        
        'rewrite' => array('slug' => ( (ICL_LANGUAGE_CODE=='en')? 'before-and-after-pictures':'fotos-antes-despues' ) ),
        'query_var' => true
    );

    register_taxonomy( 'gallerycat', array('gallery'), $args );
}

I know I am including the rewrite twice and that is wrong. I am not sure how to structure it. Without the first rewrite the slug does not change to 'before-and-after-pictures'.

With the second rewrite, the slug does change to 'fotos-antes-despues' as desired but the links do not work, even after resaving the permalinks. WordPress just auto directs me to another page on the website.

Any suggestions on how to get this to work? Thanks :)

September 23, 2013 at 6:17 pm #267893

Bruno
Forum moderator

Dear Tom,

Please keep just a 'rewrite' and replace it with this:

'rewrite' => array( 'slug' => _x('before-and-after-pictures', 'URL Slug', 'gallerycat') ),

It should appear within the WPML String Translation.

Please let me know if this solves the problem and if I can help with anything else.

Thank you.

September 23, 2013 at 8:38 pm #267942

Tom

Hi Bruno,

I made the adjustment but I don't see it under WPML String Translation. I re-scaned the theme files but it is not recognizing it.

September 24, 2013 at 7:11 pm #268494

Bruno
Forum moderator

Dear Tom,

I'll assign your ticket to Sarah who is our senior developer.

Soon she will contact you.

Thank you.

September 25, 2013 at 6:40 am #268580

sarah.n
Forum moderator

Hello Tom,

This is Sarah here. Bruno forwarded your forum thread to me so I will do my best to assist you from here. Hope this is OK with you.

I have just sent you a separate email requesting temporary access to your installation in order to assist you better.

Please let me know if you have not received anything.

Thank you.

September 26, 2013 at 3:06 pm #269390

sarah.n
Forum moderator

Tom,

This is to let you know that I have received your email with the details. Thank you!

The first step in troubleshooting this is to request that you update WPML to 2.9.2 Be sure to also update the two WPML add-ons you have active.

You can check the latest released versions under "My Account -> Downloads" on this site.

Let me know please when ready? Thank you!

September 26, 2013 at 6:30 pm #269504

Tom

Hi Sarah, I updated WPML to 2.9.2 and the add-ons I have active. I then re-scaned the theme for strings but I still see the English slug showing for the custom tax on the Spanish version of the site. I didn't find "before-and-after-pictures" in the string translation area.

September 27, 2013 at 7:03 am #269613

sarah.n
Forum moderator

Thank you for updating Tom,

So I had another look, now with fresh eyes and mind. I do apologize for not spotting this before however the "Translate custom posts slugs" setting is exactly for that; custom post slugs.

The title of your topic refers to custom taxonomy slugs. This is something entirely different and currently not supported by WPML. In other words you cannot translate custom taxonomy slugs at the moment, only custom post slugs.

Again, I am very sorry for not seeing from the beginning that you were asking about ctax slugs and not about cpt slugs!

Hope this clears up the issue for you.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘[Closed] Custom Taxonomy Slug not translating’ is closed to new replies.