0

I use the wp_editor function to display an editor in front-end.

The problem is that this editor doesnt behave like the editor in backend based on the settings I give as input:

$settings = array(
        'wpautop' => true,
            'media_buttons' => false,
        'tinymce' => array(
                'theme_advanced_buttons1' =>                       'formatselect,|,bold,italic,underline,|,' .
                                'bullist,blockquote,|,justifyleft,justifycenter' .
                                ',justifyright,justifyfull,|,link,unlink,|' .
                                ',spellchecker,wp_fullscreen,wp_adv ',
                                                                'mode' => 'specific_textareas',
),
'quicktags' => false);

wp_editor($content, 'contentEditorBox', $settings );

The website is a front end private community, and the content inserted by all members is coming from Microsoft Word. This same content, if instered in backend, appear as a text wrapped by HTML tags (p, br...) and inline CSS styles when I swap to HTML mode in editor. But in front end, the editor doesn't show the mode tabs, and content is always raw content containing no HTML and no styles.

I need that the content maintain its style i.e, to be inserted from front end like it does from backend.

How can copy-paste from MS word to wordpress editor in front end maintain the styles and HTML?

Your help is highly appreciated.

1

You must filter the content inside the editor, if you save the content. Alternativly add a tiny button to add content from MS Word inside the editor area.

I think for the usability is it better, if you filter the content from users on save his content. You can use the project WordOff to filter the content from MS Word and create clean html.

Alternative filter helpers:

  • Your answer contains many information new to me, I will understand it. Thank you very much for your time and explanations. – whiteletters in blankpapers Oct 7 '13 at 19:11
  • I need that the content is insterted with HTML tags and inline styles, I dont need to create clean HTML but maintain the original HTML, as it comes from MS Word. – whiteletters in blankpapers Oct 8 '13 at 13:49
0

The problem was coming from a php function strip_tags, that was in my code without observing it. I removed it and the problem is resolved.

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.