WordPress.org

Ready to get started?Download WordPress

Forums

[WPML] Category base translation (1 post)

  1. bilelhawari
    Member
    Posted 3 years ago #

    Hi :)

    I'm using WPML and everything is going fine. But I'm looking to give a specific category base for each language :

    Fr : site.com/rubrique/sport
    En : site.com/en/section/sport
    ...

    I made a specific plugin able to generate links like that.

    function cat_prefix(){
    	global $sitepress;
    $lang = $sitepress->get_current_language();
    switch($lang) {
    	case 'ar':
    		$pref = 'ركن';
    		break;
    	case 'fr':
    		$pref = 'rubrique';
    		break;
    	case 'en';
    		$pref = 'section';
    		break;
    	default:
    		$pref = 'rubrique';
    }
    	return $pref;
    }
    
    add_filter('option_category_base', 'cat_prefix');

    I don't like to touch rewrite.php file or any WordPress Core files.
    So how can I add my own rewrite rules to do that ?

    Thank you :)

Topic Closed

This topic has been closed to new replies.

About this Topic