WPML – PHP Fatal error: Uncaught Error: Call to undefined function str_contains()

To fix it urgently, I had to put a str_contains() polyfill right into wp-config.php: if (!function_exists(‘str_contains’)) { /** * Check if substring is contained in string * * @param $haystack * @param $needle * * @return bool */ function str_contains($haystack, $needle) { return (strpos($haystack, $needle) !== false); } } I used the polyfill from gdarko … Read more

WPML Translate term meta not synced

The trick is the update the original term. wp_update_term($term_id, $taxonomy, []); This will trigger the WPML actions that sync the meta, notice we provided [] so technically we are not updating anything but this is good enough to trigger the sync.

wpml and languages with different directions

Could not found why the is_rtl() is not working properly, but found that wpml_is_rtl is doing it’s own job, so by adding this code to theme’s functions.php everything seems to work fine: if ( apply_filters( ‘wpml_is_rtl’, null) ) { mu_fix_is_rtl(true); }else { add_filter(‘language_attributes’,’mu_alter_language_attributes’); mu_fix_is_rtl(false); } function mu_alter_language_attributes($output, $doctype){ return str_replace(‘rtl’,’ltr’,$output); } function mu_fix_is_rtl($rtl){ global $wp_locale; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)