Localisation and WordPress

WordPress has no ability to switch language based on URL or query string parameter. In fact it does no dynamic language switching at all. Wherever you’ve seen this working, it would have been using a plugin. You say you don’t want to use a plugin, which means you’ll have to write all the switching logic … Read more

How to set different localization file for different users?

By default WordPress only loads translations according to the user’s language when they’re viewing admin pages. You can see that in the code for the load_theme_textdomain function: $locale = apply_filters( ‘theme_locale’, is_admin() ? get_user_locale() : get_locale(), // ^^^^^^^^ $domain ); So your code is fine if you want to override that behaviour for the front … Read more

How to disable gettext feature?

You already have the answer, but perhaps you’re not running your code early enough. Returning true from the override_load_textdomain filter will prevent all MO files from loading, but you’ll have to run it early to catch WordPress Core translations. Adding it as a must-use plugin does the trick for me: /* Plugin Name: Disable Gettext … Read more

WordPress add_filter to post_date

You need to add an additional filter on the frontend. Very basically it would look like this: Frontend (eg. single.php): echo apply_filters( ‘my_custom_persian_filter’, $post_date ); Backend (eg. functions.php) function persian_date_function( $date ) { $date = $converted_to_persian; // there you convert date to persian return $date; } add_filter( ‘my_custom_persian_filter’, ‘persian_date_function’ );