It should no surprise that the world’s most popular content management system has robust support for dozens of languages. What it surprising is the lack of simple instructions on how to enable Right-to-left (RTL) support in WordPress for RTL languages. So here’s a quick guide on how to enable RTL support for your WordPress website.
TL;DR – Don’t fancy reading? Here’s the video tutorial 🙂
Step 1 – Ensure your WordPress theme has RTL support
This is your crucial first step. Login to your website control panel and go to /wp-content/themes/yourtheme and look for a file called rtl.css. If you’ve got one chances are pretty good that your theme has RTL support. Go ahead and open it up to ensure the author simply hasn’t created an empty css file 🙂
Step 2 – Test RTL support
Before we make a permanent switch to RTL mode, let’s test it out as an admin – in that way we can safely preview RTL support before making it available to all our website visitors.
Go to Plugins -> Add New and search for “RTL Tester” – or you can grab the plugin over on the WordPress.org repo.
Once you install the plugin you’ll see this new option in your WP toolbar
Once you click “Switch to RTL” the WordPress user interface switches to RTL mode.
If you go to your website frontend you should also see that it now displays Right-to-left. Here’s what the Success WordPress theme looks like with RTL enabled.
Step 3 – Enable RTL Support permanently
Once you’re happy with how your website looks with RTL mode enabled, it’s time to make the switch permanent.
Open up your wp-config.php and add the following:
define ('WPLANG', 'ar');
In this case, “ar” refers to the Arabic language. Check out the full list of ISO language codes.
Then hop on over to Settings -> General -> Site Language – and select your language.
Hit “Save Changes” and you’re done!
When you go to your website you should now see RTL mode is enabled.
Check out our video tutorial which shows the process in detail.