Title: Admin Control Panel language changes Post text allignment as well
Last modified: August 3, 2020

---

# Admin Control Panel language changes Post text allignment as well

 *  Resolved [jameshallow1](https://wordpress.org/support/users/jameshallow1/)
 * (@jameshallow1)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/)
 * Hello,
 * Since WordPress 4.7 users are able to change their profile language so that the
   admin control panel changes it that language instead of the site language.
 * My site is in a RTL (right-to-left) language while i have set my profile language
   to be in English (LTR language)
 * Now the site content is always and will remain always RTL so when posting a new
   post the text alignment should remain by default RTL however its changing to 
   LTR as per my own language preference.
 * How is it possible to make wordpress leave the new post text alignment RTL as
   per the original website language.
 * Thank you

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13218891)
 * Where do you want the direction changed? Front or back end, or both? Which language
   are your posts in? Please distinguish between language _direction_ and text _alignment_.
   Applying a RTL direction to a LTR language can result in strange artifacts, word
   order being reversed in small sections. In contrast, aligning text in whatever
   language is strictly an appearance thing and does not affect word order.
 *  Thread Starter [jameshallow1](https://wordpress.org/support/users/jameshallow1/)
 * (@jameshallow1)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13219659)
 * In the post edit (post-new.php) so back end.
 * My posts are in arabic and front end is in arabic however editors have their 
   profile set in English.
    RTL direction is applied using site language (arabic)
   so it shows the site correctly in RTL format.
 * So here comes the problem, site is set as RTL so it shows correctly (front end
   wise) and admin panel is shown in LTR (English) so editors can easily navigate
   through the control panel in english, However when they are typing they are typing
   in RTL (arabic) which means everytime they have to write an article they need
   to manually align the title and text to RTL.
 * I hope i made this clear… Is it possible to make wordpress new post edits align
   automatically to RTL to match the site language and content (which should make
   sense more then aligning according to the Control Panel Language)
 * [https://ibb.co/2d7VTBz](https://ibb.co/2d7VTBz)
 * As mentioned this can be done manually in the paragraph block by aligning the
   text to the right but i was hoping that this could be done in some way even if
   it required code modification as its a hassle to do that on every article.
 * Thank you
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13223210)
 * So editors like to have English nav even though they type posts in Arabic. We
   can apply custom post editor styles. This is meant for enabling themes to have
   the editor style match that of the theme. We can apply `direction: rtl;` CSS 
   rule to editor elements to cause whatever is typed to be handled as an RTL language.
 * First enable editor styling in functions.php:
    `add_theme_support('editor-styles');`
 * Then enqueue an editor .css stylesheet with [add_editor_style()](https://developer.wordpress.org/reference/functions/add_editor_style/).
   Ignore the part about -rtl file names since WP is set for a LTR language. There
   is example code in the user notes near the bottom of the doc.
 * Probably all you need on the stylesheet is `* {direction: rtl;}` though it might
   be a good idea to define a `.ltr` class style in case someone needs to use a 
   LTR language in a post.
 *  Thread Starter [jameshallow1](https://wordpress.org/support/users/jameshallow1/)
 * (@jameshallow1)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13224429)
 * Yes that’s what I want.
 * you said:
    First enable editor styling in functions.php: `add_theme_support('
   editor-styles');`
 * Adding that to functions.php made the site inaccessible (something went wrong
   with wordpress message)
 *  Thread Starter [jameshallow1](https://wordpress.org/support/users/jameshallow1/)
 * (@jameshallow1)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13224445)
 * I tried adding the below as well to functions.php:
    [https://i.ibb.co/BVgy8ML/Capture.png](https://i.ibb.co/BVgy8ML/Capture.png)
 * and creating a **custom-editor-style.css** in my theme root folder with the below
   CSS Code:
    `* {direction: rtl;}`
 * with the same result…
    adding `add_theme_support('editor-styles');` is breaking
   wordpress.
 * To recap what i need is to only make the title field and “post/text” paragraph
   aligned for RTL as per the wordpress language set (which is RTL):
    [https://ibb.co/2d7VTBz](https://ibb.co/2d7VTBz)(
   those by default/automatically aligned to RTL instead of LTR)
    -  This reply was modified 5 years, 10 months ago by [jameshallow1](https://wordpress.org/support/users/jameshallow1/).
      Reason: adding info
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13226336)
 * As it turns out, despite what I saw in docs about `add_theme_support('editor-
   styles');`, you don’t really need it, you only need to call `add_editor_style();`,
   assuming editor-style.css is your CSS file in the theme’s root folder. Pass the
   relative path to the correct .css file if it’s named differently or located somewhere
   else. If that call alone doesn’t break anything, it should do what we want.
 * I did confirm that `* {direction: rtl;}` added as we discussed does in fact cause
   editor text to have RTL direction on my test site running a child theme of twentysixteen.
 * If just `add_editor_style()` alone still causes trouble with your theme, we could
   output our CSS rule from the “admin_print_styles” action. Done this way, we’d
   output `<style>.editor-styles-wrapper * {direction: rtl;}</style>`. The editor
   style mechanism automatically adds `.editor-styles-wrapper` selector. We have
   to do so ourselves using this approach.
 * Once you find something that works, I recommend you move your added custom code
   into a [child theme](https://developer.wordpress.org/themes/advanced-topics/child-themes/).
   I didn’t wish to complicate things to start with, but directly editing your theme(
   unless it’s a custom theme that’s not part of the update process) is not a good
   long term solution.
    -  This reply was modified 5 years, 10 months ago by [bcworkz](https://wordpress.org/support/users/bcworkz/).
 *  Thread Starter [jameshallow1](https://wordpress.org/support/users/jameshallow1/)
 * (@jameshallow1)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13226635)
 * Thanks a lot for your help! i really appreciate it.
 * I added the below to **functions.php**:
 *     ```
       function wpdocs_theme_add_editor_styles() {
           add_editor_style( 'editor-style.css' );
       }
       add_action( 'admin_init', 'wpdocs_theme_add_editor_styles' );
       ```
   
 * _It did not “break” wordpress._
 * then created a file called **editor-style.css** in my theme root folder, and 
   wrote the below code in it:
    `* {direction: rtl;}`
 * However it did not have any effect, the text alignment is still LTR in post-new.
   php (new post)
    -  This reply was modified 5 years, 10 months ago by [jameshallow1](https://wordpress.org/support/users/jameshallow1/).
 *  Thread Starter [jameshallow1](https://wordpress.org/support/users/jameshallow1/)
 * (@jameshallow1)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13226692)
 * wrongly reported that its working
    -  This reply was modified 5 years, 10 months ago by [jameshallow1](https://wordpress.org/support/users/jameshallow1/).
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13228700)
 * Your exact code works on my test site. Are you using the default block editor?
 * There could be a conflict with other editor styling from elsewhere. Use your 
   browser’s element inspector developer tool to inspect a paragraph of editor content.
   There should be an active rule listed:
 *     ```
       .editor-styles-wrapper * {
           direction: rtl;
       }
       ```
   
 * direction rule not lined or grayed out. If it is, try adding the `!important`
   modifier:
    `direction: rtl !important;`
 *  Thread Starter [jameshallow1](https://wordpress.org/support/users/jameshallow1/)
 * (@jameshallow1)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13233372)
 * I tried doing it with !important but it still wouldn’t work.
 * As per your suggestion i did inspect the element and there was no direction:rtl.
   here is a screenshot of the Inspect Element:
    [https://ibb.co/28CdyP0](https://ibb.co/28CdyP0)
 * Just for testing purposes i added the direction: rtl (without important) to .
   editor-styles-wrapper using the inspect element and it worked..
 * So the problem is that its not getting the direction: rtl from the new css file.
 * To recap:
    The code was added to the functions.php found in the root folder of
   my theme. The .css file was added to the root folder of my theme
 * I am using the default editor (Gutenberg) that comes with the latest wordpress
   version.
    Screenshot of the editor: [https://ibb.co/ZV12csx](https://ibb.co/ZV12csx)
 * Found this just now: [https://github.com/WordPress/gutenberg/issues/7913](https://github.com/WordPress/gutenberg/issues/7913)
   
   I’m not sure if its related to the problem I’m facing. are you using Gutenberg
   as well?
    -  This reply was modified 5 years, 10 months ago by [jameshallow1](https://wordpress.org/support/users/jameshallow1/).
      Reason: added editor screenshot
    -  This reply was modified 5 years, 10 months ago by [jameshallow1](https://wordpress.org/support/users/jameshallow1/).
    -  This reply was modified 5 years, 10 months ago by [jameshallow1](https://wordpress.org/support/users/jameshallow1/).
      Reason: Gutenberg
 *  Thread Starter [jameshallow1](https://wordpress.org/support/users/jameshallow1/)
 * (@jameshallow1)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13233435)
 * Solved! It worked as follows:
 * **style-editor.CSS File:**
    `* {direction: rtl;}`
 * **functions.PHP File:**
 *     ```
       function wpdocs_theme_add_editor_styles() {
       	add_theme_support( 'editor-styles' );
       	add_editor_style( 'style-editor.css' );
       }
       add_action( 'after_setup_theme', 'wpdocs_theme_add_editor_styles' );
       ```
   
    -  This reply was modified 5 years, 10 months ago by [jameshallow1](https://wordpress.org/support/users/jameshallow1/).
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13238030)
 * Yes, I was checking with Gutenberg. “Block Editor” == “Gutenberg” 😉 Gutenberg
   was the editor’s development code name. As it is used in WP, it’s officially “
   [Block Editor](https://developer.wordpress.org/block-editor/)“. The code name
   has stuck though and the editor is commonly referred to as that.
 * I think the Git issue you linked was resolved by having WP prepend `.editor-styles-
   wrapper` selector to all editor style rules. Obviously add_editor_style() does
   work now and application does not bleed out of the editor.
 * The only substantive change in your working code is the action hook used. (add_theme_support()
   is called by add_editor_style(), so it’s not needed, but it does no harm in using
   it either) That’s odd, as either action hook should work. They both work on my
   site. Anyway, you got it working, that’s all that really matters.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Admin Control Panel language changes Post text allignment as well’ is
closed to new replies.

## Tags

 * [language](https://wordpress.org/support/topic-tag/language/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [RTL](https://wordpress.org/support/topic-tag/rtl/)
 * [text alignment](https://wordpress.org/support/topic-tag/text-alignment/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 12 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/admin-control-panel-language-changes-post-text-allignment-as-well/#post-13238030)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
