skip to Main Content

I’m trying to find a solution for this for weeks and I’m finding answers all
over the internet but I do not know where and how to add this very short script.

I want to have plain text paste enabled on my frontend wordpress tinymce.

So people say use this

tinymce.init({
    plugins: "paste",
    paste_as_text: true
});

But I don’t know where to put this script in.
The class-wp-editor.php does not have any tinymce.init config that I can find.
Would be great if I can solve this.
Thanks

2

Answers


  1. Chosen as BEST ANSWER

    Thank you for your respond.

    Still I don't know how where to add this. Do I need to add this to my function.php or a new .php file. If so how can I make tinymce see this file?

    This is the script I use to display the tinymce at the frontend. With searching over the internet I added the 'paste as text' => true in, but this does not help as the editor still paste in styled format. Did I do this correct, if not, how to enable 'paste as text'?

    <?php $cont = isset($post) ? $post->post_content : '';
                                                wp_editor(wpautop(stripslashes($cont)),'post_content', array(
                                                    'paste_as_text' => true, 
                                                    'textarea_name' => 'pack[post_content]',
                                                    'teeny' => 1, 'media_buttons' => 0,
                                                    'tinymce' => array('toolbar1' => 'bold,italic,underline,blockquote,strikethrough,bullist,link,unlink,media,mybutton'),
                                                    'quicktags' => false, 'textarea_rows' => 15)); ?>
    

  2. I would use
    wp_editor()
    with a shortcode.

    tinymce is part of settings.

    $settings = array( 'tinymce' => array('your_options') );
    wp_editor($content, $editor_id, $settings);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search