Questions the author answers
How can I define my own substitutions?
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' );
How can I redefine non-standard locale?
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' );
How can I define my own transliteration of titles?
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 );
How can I control the legacy sanitize_title bridge?
Version 7.0 uses explicit slug handlers for posts, terms, WooCommerce attributes, and other known save paths. A legacy sanitize_title bridge remains as a compatibility fallback for broad calls that older integrations may still rely on.
You can disable the broad fallback with this code:
add_filter( 'ctl_enable_legacy_sanitize_title_bridge', '__return_false' );
How can I define my own transliteration of filenames?
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 );
How can I allow the plugin to work on the frontend?
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'] ) ) : '';