I have problem when edit an news in post editor, and set the images from editor align left and open site, i cannot see the image in left said.

How can set the post style from editor not from style

  • Maybe the theme you use does not have css definitons for the alignleft class that the added image has. – aifrim Sep 17 '14 at 16:15
  • no i add it ,,, any solution – Khalid Ahmed Sep 17 '14 at 18:19
  • Write the code that you added :) – aifrim Sep 18 '14 at 6:43

add_editor_style allows theme developers to link a custom stylesheet file to the TinyMCE visual editor.

You'll want to duplicate many (if not all) of your styles from the front-end to be included in that file. Then editing in the visual editor will look more like your front-end css.

The problem is more likely that you don't have a alignleft class in your front-end stylesheet. wp_print_styles will give you an opportunity to add custom inlined styles.

add_action('wp_print_styles', function() { ?>
     * 4.0 - Alignment

    .alignleft {
        float: left !important;
        margin: 6px 28px 28px 0;

    .alignright {
        float: right !important;
        margin: 6px 0 28px 28px;

If you literally want to put the editor styles on the front-end (which nobody said ever) then just wp_enqueue_scripts.

add_action('wp_enqueue_scripts', function() {
    wp_enqueue_style('editor-styles', includes_url('/css/editor.css'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.