• Resolved egroj3

    (@egroj3)


    I am building a form that creates new posts, but in the form, the body content editor for those posts is the visual editor. How can I disable the visual editor (and text editor) and just use a text-area field instead?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hi there @egroj3

    Unfortunately, there is no option to use a plain textarea instead of a rich text editor in the Post Data field.

    But you can fake it. ??

    Just add this in the Custom CSS box in your form’s Appearance settings (at the bottom of the screen there) to hide the unwanted parts of the content field:

    .wp-editor-tabs, .mce-top-part, .quicktags-toolbar {
        display: none;
    }

    That would make your form look something like this:
    https://monosnap.com/file/W80U1xVGQXVHjnMInKQJ4IwlxJNsH1

    Cheers!
    Patrick

    Thread Starter egroj3

    (@egroj3)

    Thank you! Would users still be able to format their text with ctrl + b, etc.?

    I thought maybe there was some php I could alter in the plug-in to switch the rich text editor to the textarea. Is that possible? I really can’t have users submitting anything other than plain text.

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @egroj3 ,

    Please check this mu-plugin:

    <?php
    
    add_filter(
    	'forminator_field_create_wp_editor',
    	function( $html, $attr, $label, $description ){
    		$required = false;
    		$design   = '';
    		return Forminator_Field::create_textarea( $attr, $label, $description, $required, $design );
    	},
    	10,
    	4
    );

    (more about mu-plugins here https://premium.wpmudev.org/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins )

    You can change $required = false; to true if the field needs to be required.

    kind regards,
    Kasia

    Thread Starter egroj3

    (@egroj3)

    Thank you very much! This works perfectly. I’ll mark the topic resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to disable visual editor for create post?’ is closed to new replies.