Hello,
I have created a classifieds site in a non latin language. The problem is that many systems do not recognize non latin characters in permalinks and they are very bad for seo. The solution is to make use of a very simple plugin that rewrites non latin with latin characters in url.
But how could I make this plugin compatible with cred? If I create a post from admin dashboard non latin characters are automatically converted to latin characters in the url. But that does not work for the users that create classifieds from the frontend with cred form. How could make cred read the plugin before the creation of the post?
Here is the code that is contained in the plugin
function greeklish_permalinks_sanitize_title($text) {
if ( !is_admin() ) return $text;
$expressions = array(
'/[αΑ][ιίΙΊ]/u' => 'e',
'/[οΟΕε][ιίΙΊ]/u' => 'i',
'/[αΑ][υύΥΎ]([θΘκΚξΞπΠσςΣτTφΡχΧψΨ]|\s|$)/u' => 'af$1',
'/[αΑ][υύΥΎ]/u' => 'av',
'/[εΕ][υύΥΎ]([θΘκΚξΞπΠσςΣτTφΡχΧψΨ]|\s|$)/u' => 'ef$1',
'/[εΕ][υύΥΎ]/u' => 'ev',
'/[οΟ][υύΥΎ]/u' => 'ou',
'/(^|\s)[μΜ][πΠ]/u' => '$1b',
'/[μΜ][πΠ](\s|$)/u' => 'b$1',
'/[μΜ][πΠ]/u' => 'b',
'/[νΝ][τΤ]/u' => 'nt',
'/[τΤ][σΣ]/u' => 'ts',
'/[τΤ][ζΖ]/u' => 'tz',
'/[γΓ][γΓ]/u' => 'ng',
'/[γΓ][κΚ]/u' => 'gk',
'/[ηΗ][υΥ]([θΘκΚξΞπΠσςΣτTφΡχΧψΨ]|\s|$)/u' => 'if$1',
'/[ηΗ][υΥ]/u' => 'iu',
'/[θΘ]/u' => 'th',
'/[χΧ]/u' => 'ch',
'/[ψΨ]/u' => 'ps',
'/[αάΑΆ]/u' => 'a',
'/[βΒ]/u' => 'v',
'/[γΓ]/u' => 'g',
'/[δΔ]/u' => 'd',
'/[εέΕΈ]/u' => 'e',
'/[ζΖ]/u' => 'z',
'/[ηήΗΉ]/u' => 'i',
'/[ιίϊΙΊΪ]/u' => 'i',
'/[κΚ]/u' => 'k',
'/[λΛ]/u' => 'l',
'/[μΜ]/u' => 'm',
'/[νΝ]/u' => 'n',
'/[ξΞ]/u' => 'x',
'/[οόΟΌ]/u' => 'o',
'/[πΠ]/u' => 'p',
'/[ρΡ]/u' => 'r',
'/[σςΣ]/u' => 's',
'/[τΤ]/u' => 't',
'/[υύϋΥΎΫ]/u' => 'y',
'/[φΦ]/iu' => 'f',
'/[ωώ]/iu' => 'o'
);
$text = preg_replace( array_keys($expressions), array_values($expressions), $text );
return $text;
}
add_filter('sanitize_title', 'greeklish_permalinks_sanitize_title', 1);
Is there a way to make cred recognize this code?
Thank you!