is_rtl() not working from plugin

I use Polylang to make my website multilingual, when using an RTL language, I see that rtl.css is being loaded, so everything works fine.

I made a custom plugin that adds another CSS file if the language in the front-end is an RTL language, using the WordPress function is_rtl(), but it is returning false in the front-end! although I can see the rtl.css file of the theme.

if( ! is_admin() ) {
    if (is_rtl()) require_once dirname( RTLCSS_DIR ) . '/includes/rtl-css.php';

How can I tell the plugin that the front-end language is an RTL one?

Read more here: is_rtl() not working from plugin

Leave a Reply

Your email address will not be published. Required fields are marked *