Created
November 16, 2014 20:27
-
-
Save scheurta/1a268c2a50576048a2a5 to your computer and use it in GitHub Desktop.
Polylang Rewrite Slugs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Post types slugs | |
* | |
*/ | |
add_filter( 'pll_translated_post_type_rewrite_slugs', function( $post_type_translated_slugs ) | |
{ | |
$post_type_translated_slugs = array( | |
// cpt_name | |
'cpt_name' => array( | |
'sv' => array( | |
'has_archive' => true, | |
'rewrite' => array( | |
'slug' => 'produkter', | |
), | |
), | |
'en' => array( | |
'has_archive' => true, | |
'rewrite' => array( | |
'slug' => 'products', | |
), | |
), | |
'de' => array( | |
'has_archive' => true, | |
'rewrite' => array( | |
'slug' => 'produkte', | |
), | |
), | |
) | |
); | |
return $post_type_translated_slugs; | |
}); | |
/** | |
* Taxonomy slugs | |
* | |
*/ | |
add_filter( 'pll_translated_taxonomy_rewrite_slugs', function( $taxonomy_translated_slugs ) | |
{ | |
$taxonomy_translated_slugs = array( | |
// tax_name | |
'tax_name' => array( | |
'sv' => 'produkter/malgrupp', | |
'en' => 'products/target-group', | |
'de' => 'produkte/zielgruppe' | |
) | |
); | |
return $taxonomy_translated_slugs; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment