Cyr-To-Lat
Sergey BiryukovConverts Cyrillic characters in post, page and term slugs to Latin characters. Useful for creating human-readable URLs.
Features
- The only plugin with fully editable transliteration table. Allows to add/remove and edit pairs like ‘Я’ => ‘Ya’, or even ‘Пиво’ => ‘Beer’
- Converts any number of existing post, page and term slugs in background processes
- Saves existing post and page permalinks integrity
- Performs transliteration of attachment file names
- The plugin supports Russian, Belorussian, Ukrainian, Bulgarian, Macedonian, Serbian, Greek, Armenian, Georgian, Kazakh, Hebrew, and Chinese characters
- Has many advantages over similar plugins
- Officially compatible with WPML
Based on the original Rus-To-Lat plugin by Anton Skorobogatov.
Sponsored by Blackfire.
Plugin Support
Add this code to your theme’s functions.php
file:
/**
* Modify conversion table.
*
* @param array $table Conversion table.
*
* @return array
*/
function my_ctl_table( $table ) {
$table['Ъ'] = 'U';
$table['ъ'] = 'u';
return $table;
}
add_filter( 'ctl_table', 'my_ctl_table' );
For instance, if your non-standard locale is uk_UA, you can redefine it to uk
by adding the following code to your theme’s function.php
file:
/**
* Use non-standard locale.
*
* @param string $locale Current locale.
*
* @return string
*/
function my_ctl_locale( $locale ) {
if ( 'uk_UA' === $locale ) {
return 'uk';
}
return $locale;
}
add_filter( 'ctl_locale', 'my_ctl_locale' );
Add similar code to your theme’s functions.php
file:
/**
* Filter title before sanitizing.
*
* @param string|false $result Sanitized title.
* @param string $title Title.
*
* @return string|false
*/
function my_ctl_pre_sanitize_title( $result, $title ) {
if ( 'пиво' === $title ) {
return 'beer';
}
return $result;
}
add_filter( 'ctl_pre_sanitize_title', 10, 2 );
Add similar code to your theme’s functions.php
file:
/**
* Filter filename before sanitizing.
*
* @param string|false $result Sanitized filename.
* @param string $filename Title.
*
* @return string|false
*/
function my_ctl_pre_sanitize_filename( $result, $filename ) {
if ( 'пиво' === $filename ) {
return 'beer';
}
return $result;
}
add_filter( 'ctl_pre_sanitize_filename', 10, 2 );
Add the following code to your plugin’s (or mu-plugin’s) main file. This code won’t work being added to a theme’s functions.php file.
/**
* Filter status allowed Cyr To Lat plugin to work.
*
* @param bool $allowed
*
* @return bool
*/
function my_ctl_allow( bool $allowed ): bool {
$uri = isset( $_SERVER['REQUEST_URI'] ) ?
sanitize_url( wp_unslash( $_SERVER['REQUEST_URI'] ) ) :
'';
if ( 0 === strpos( $uri, '/divi-comments' ) ) {
return true;
}
return $allowed;
}
add_filter( 'ctl_allow', 'my_ctl_allow' );
Add similar code to your theme’s functions.php
file:
/**
* Filter post types allowed for background conversion.
*
* @param array $post_types Allowed post types.
*
* @return array
*/
function my_ctl_post_types( $post_types ) {
return [
'post' => 'post',
'page' => 'page',
'attachment' => 'attachment',
'product' => 'product',
'nav_menu_item' => 'nav_menu_item',
];
}
add_filter( 'ctl_post_types', 'my_ctl_post_types' );
Use the following command in the console:
wp cyr2lat regenerate [--post_type=<post_type>] [--post_status=<post_status>]
Where
-post_type is a list of post types,
-post_status is a list of post statuses.
Regeneration of thumbnails with the command wp media regenerate
can break links in old posts as file names become transliterated.
To avoid it, deactivate cyr2lat plugin during regeneration:
wp media regenerate --skip-plugins=cyr2lat
Yes, you can!
- Join in on our GitHub repository
- Join in on our Telegram Group
Problems with some languages
By alexmcmeekin2017 on May 6, 2024
The plugin supports Russian, Belorussian, Ukrainian, Bulgarian, Macedonian, Serbian and Kazakh characters. Unfortunately, support for other languages (Greek, Armenian, Georgian, Hebrew, and Chinese) does not work at all.
Ура! Заработало!
By vl33 on February 12, 2024
С последним обновлением стали корректно работать ранее созданные атрибуты, раньше после выгрузки отключал плагин, сейчас работает как надо. Спасибо!
Метки и категории не отключаемы
By AndreyPominov (pominov) on October 15, 2023
Плагин отличный (6.0.5), транслитерировал урлы (слаги для продвинутых) записей, страниц и меню и всего остального.
Обратите внимание, что транслитерацию урлов всех меток (/tag/) и категорий (/category/) он тоже сделает, а в настройках нет отдельных пунктов отвечающих за метки и категории.
Не перетворює літеру Є
By tux255 on June 19, 2023
Не перетворює літеру Є, вона залишається без змін.
обновление не дает делать запрос к БД
By mirina29 on May 17, 2023
После обновления WordPress перестал выполняться запрос к базе данных , т.е. просто ничего не выдавало.
я обновила все плагины , в том числе и Cyr2Lat.
проблема не решилась. На хостинге проверили БД, ошибок не было.
Меня спас тестовый аналогичный сайт, на котором WP был обновлен, но все работало хорошо.
и вот там после обновления вашего плагина, картина с запросом повторилась, т.е не работал запрос к БД
у меня была старая версия 5.3.0.
после отката на нее, запрос отрабатывает отлично.
Транслітерація української мови
By kovalrobert on May 2, 2023
Українська транслітерація не відповідає постанові Кабінету Міністрів України від 27 січня 2010 р. № 55, яка визначає стандарт для транслітерації української мови, треба вручну виправляти.
Отлично!
By kotden on April 26, 2023
Всегда использую этот плагин!
Неплохо, но нет импорта-экспорта настроек
By Ivaseg on April 11, 2023
Ужасно не хватает возможности импорта/экспорта настроек плагина. Когда у тебя пару десятков сайтов - это боль настраивать на каждом таблицу символов.
Плагин отличный, но есть проблемка.
By klim93 on March 24, 2023
Добрый день! Плагин отличный, но есть проблема с вариациями в woocommerce после последнего обновления, почему то скрывает произвольные вариации которые на русском языке.
Отлично!
By Vladimir Sosnovskiy on February 6, 2023
Здорово выручает, Большое Спасибо за толковый плагин!
6.1.0 (09.03.2024)
- Tested with WordPress 6.5.
- Tested with WooCommerce 8.6.
- Fixed error on System Info tab when post types or post statuses are not set.
6.0.8 (14.02.2024)
- Improved detection of the Gutenberg editor.
- Fixed processing of product attributes.
6.0.7 (11.02.2024)
- Tested with WooCommerce 8.5.
- Added redirect from the cyrillic post title when creating a new post.
- Added description of post types and post statuses on the Converter page.
- Fixed displaying all file descriptions in the Theme Editor in the current locale.
- Fixed PHP warning in SettingsBase.
- Fixed output of variable product attributes.
6.0.6 (14.01.2024)
- Tested with WordPress 6.4.
- Tested with WooCommerce 8.4.
- Tested with PHP 8.3.
- Fixed documentation on ctl_allow filter.
- Fixed improper display of the “rate plugin” message on options.php.
6.0.5 (09.10.2023)
- Fixed displaying file descriptions in the Theme Editor; now in the current locale.
6.0.4 (23.09.2023)
- Fixed disappeared file descriptions on the Theme File Editor page.
6.0.3 (29.07.2023)
- Fixed the fatal error with Jetpack sync.
6.0.2 (26.07.2023)
- Fixed fatal error in admin_footer_text().
6.0.1 (26.07.2023)
- Fixed the fatal error on the System Info page with empty options.
6.0.0 (26.07.2023)
- Dropped support of PHP 5.6. The Minimum required PHP version is 7.0 now.
- Tested with WordPress 6.3.
- Tested with WooCommerce 7.9.
- Added System Info tab.
- Added filter ‘ctl_allow’
- Fixed console error when saving table data.
- Fixed the current table setting on the Tables page with WPML.
- Upload
cyr2lat
folder to the/wp-content/plugins/
directory. - Activate the plugin through the ‘Plugins’ menu in WordPress.
Reviews
4.7 out of 5 stars
- Version: 6.1.0
- Last updated: 6 months ago
- Active installations: 200K
- WordPress version: 5.1
- Tested up to: 6.5.5
- PHP version: 7.0.0