0

I'm currently testing a content crawler which crawls a feed and saves post in my website.

I should also mention that my website has a Greek -> Latin slug plugin.

I've been trying to figure this out, but still nothing.

Whenever i create / publish a post, the slugs are automatically converted to latin characters.

When the crawler creates / publishes a post, the slugs remain unconverted.

This is the slug convertion code:

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);

Can't figure out when this code runs and why it won't convert the slugs when the crawler creates the posts.

Any help is appreciated! :)

  • What is the code that the crawler uses to create the posts? – Jacob Peattie Oct 21 '17 at 1:31
  • i can't find it. The crawler is too complex with hundreds of files. – user2093301 Oct 21 '17 at 8:33
  • is the crawler a opensource plugin we can test ? – mmm Oct 21 '17 at 9:14
  • Unfortunately no. It's called WP Content Crawler (codecanyon) – user2093301 Oct 21 '17 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.