• Resolved Simon Blackbourn

    (@lumpysimon)


    Is there a filter available (or some other method) that would allow me to replace the WP Editor field with a plain textarea when creating/editing docs on the front-end?

    Thanks 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author David Cavins

    (@dcavins)

    For some reason, the WP Editor ignores some passed parameters in this case. For instance:

    add_filter( 'bp_docs_wp_editor_args', 'filter_wp_editor_for_bp_docs' );
    function filter_wp_editor_for_bp_docs( $settings ) {
    	$settings['tinymce'] = 0;
    	$settings['teeny'] = 1;
    	$settings['textarea_rows'] = 4;
    	return $settings;
    }

    The “rows” setting is respected, but not the TinyMCE prevention. I’m not sure why, actually. So, in theory it should be possible to disable TinyMCE, but it looks like it is not that simple.

    Thread Starter Simon Blackbourn

    (@lumpysimon)

    Hi David

    Your code almost works for me – I’ve changed it slightly and it now works perfectly:

    
    $settings['tinymce']       = false;
    $settings['textarea_rows'] = 4;
    $settings['quicktags']     = false;
    

    Cheers
    Simon

    Plugin Author David Cavins

    (@dcavins)

    Well that’s interesting. So the magic combination is setting quicktags AND tinymce to false or 0. I didn’t know what Quicktags are, so would never have tried to disable that option. https://developer.ww.wp.xz.cn/apis/handbook/quicktags/

    In the end, the minimum required code to force the Docs editor’s instance of WP Editor to be a textarea is:

    add_filter( 'bp_docs_wp_editor_args', 'force_bp_docs_editor_pane_to_be_textarea_only' );
    function force_bp_docs_editor_pane_to_be_textarea_only( $settings ) {
    	$settings['tinymce'] = false;
    	$settings['quicktags'] = false;
    	return $settings;
    }

    Thanks for sharing!

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

The topic ‘Replace WP editor field with textarea’ is closed to new replies.