is_rtl(): bool
- Since
- 3.0.0
- Source
wp-includes/l10n.php:1817
Description
For more information on this and similar theme functions, check out the https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags article in the Theme Developer Handbook.
Compatibility
- WordPress
- since 3.0.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Return value
bool- Whether locale is RTL.
Performance profile
How much work a call to is_rtl() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 4–6
- Plugin surface
- None
- Called by
- 27
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 7.
Nothing here hands control to plugin code.
27 places in core call this, so the cost is paid more often than your own code shows.
What one call costs · 2 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost is_rtl() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!($wp_locale instanceof) | 4 | none |
$wp_locale instanceof | 6 | ->is_rtl() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 7 instructions, 4–6 executed per call, 1 branch. The work does not change between versions.
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Used by · 27
- Twenty_Twenty_One_Dark_Mode::enqueue_scripts()Enqueues scripts and styles.
- Twenty_Twenty_One_Dark_Mode::the_html()Prints the dark-mode switch HTML.
- WP_Sitemaps_Stylesheet::get_stylesheet_css()Gets the CSS to be included in sitemap XSL stylesheets.
- _WP_Editors::print_default_editor_scripts()Print (output) all editor scripts and default settings.
- _WP_Editors::wp_mce_translation()Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n(), or as JS snippet that should run after tinymce.js is loaded.
- _mce_set_direction()Sets the localized direction for MCE plugin.
- _wp_die_process_input()Processes arguments passed to wp_die() consistently for its handlers.
- add_editor_style()Adds callback for custom TinyMCE editor stylesheets.
- display_header()Display installation header.
- gallery_shortcode()Builds the Gallery shortcode output.
- get_bloginfo()Retrieves information about the current site.
- get_body_class()Retrieves an array of the class names for the body element.
Show all 27
- get_default_block_editor_settings()Returns the default block editor settings.
- get_language_attributes()Gets the language attributes for the 'html' tag.
- iframe_header()Generic Iframe header for use with Thickbox.
- login_header()Outputs the login page header.
- register_admin_color_schemes()Registers the default admin color schemes.
- register_block_style_handle()Finds a style handle for the block metadata field. It detects when a path to file was provided and registers the style under automatically generated handle name. It returns unprocessed style handle otherwise.
- register_core_block_style_handles()Registers core block style handles.
- setup_config_display_header()Display setup wp-config.php file header.
- twenty_twenty_one_change_calendar_nav_arrows()Changes the default navigation arrows to svg icons
- twenty_twenty_one_the_posts_navigation()Prints the next and previous posts navigation.
- twentyeleven_get_default_theme_options()Returns the default options for Twenty Eleven.
- wp_admin_css()Enqueues or directly prints a stylesheet link to the specified CSS file.
- wp_default_styles()Assigns default styles to $styles object.
- wp_enqueue_block_style()Enqueues a stylesheet for a specific block.
- wp_iframe()Outputs the iframe to display the media upload page.
Source code
function is_rtl() { global $wp_locale; if ( ! ( $wp_locale instanceof WP_Locale ) ) { return false; } return $wp_locale->is_rtl();}Changelog
Introduced in 3.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, from
src/wp-includes/l10n.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.