WordPress at a glance
function is not described

_mce_set_direction() WP 2.1.0

Set the localized direction for MCE plugin.

Will only set the direction to 'rtl', if the WordPress locale has the text direction set to 'rtl'.

Fills in the 'directionality' setting, enables the 'directionality' plugin, and adds the 'ltr' button to 'toolbar1', formerly 'theme_advanced_buttons1' array keys. These keys are then returned in the $mce_init (TinyMCE settings) array.

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

No Hooks.


Array. Direction set for 'rtl', if needed by locale.


_mce_set_direction( $mce_init );
$mce_init(array) (required)
MCE settings array.


Since 2.1.0 Introduced.

Code of _mce_set_direction() WP 5.7

function _mce_set_direction( $mce_init ) {
	if ( is_rtl() ) {
		$mce_init['directionality'] = 'rtl';
		$mce_init['rtl_ui']         = true;

		if ( ! empty( $mce_init['plugins'] ) && strpos( $mce_init['plugins'], 'directionality' ) === false ) {
			$mce_init['plugins'] .= ',directionality';

		if ( ! empty( $mce_init['toolbar1'] ) && ! preg_match( '/\bltr\b/', $mce_init['toolbar1'] ) ) {
			$mce_init['toolbar1'] .= ',ltr';

	return $mce_init;