Site logo

Archived topic

Double space in editors

14 replies · Started by trevor on February 14, 2020

Viewing posts 1–15 of 15

Hello, when I use the default WP editor in backend for creating posts, I also have frontend plugin but I disabled for checking. Every time I hit return by default it double spaces between each sentence.

Please.. How do I stop this? If I use a different theme the issue goes away, I am really not sure why you would want double spacing between sentences.

It is driving me mad.

Hi there,

GP doesn't interfere with how the editor behaves.
So either plugin conflict - check by disabling all plugins including GP Premium disabled.
Or a bad function in a Child Theme or a Hook Element - can you check these as well.

Let me know

disabled all plugins still same issue
activated 2016 theme problem goes away, when I press return in editor no double space, I activate Generate Press and I get double space in editor when I press return.

Yippee!

That worked added the CSS , thank you Sir!

It was line height.
I just put it under general css, but will try adding it to body.

Hello, I looked at Customizer > Typography > Body

that changes line height all over the content, my issue is just with editors backend and front end.

I don't think we are really understanding the problem.

Are you able to provide a screenshot or guide us to the element you are referring to?

You can upload screenshots using a site like this if needed:
https://postimages.org/

Let us know :)

Hi, not sure how else to explain.....

When you go to create a new post...

You type a line of text and press enter. instead on one space , you get a double space, the only way around it is to press SHIFT+Enter.

This is really terrible solution as my users wont want to do this.
If I activate another theme eg 2016 theme I don't have this problem.

I only have this problem in the editor , create new post...

So when I am typing I get

this a line

this is the next line

Double spacing.... not wanted.

I believe what you are referring to is the Paragraph margin option under Typography > Body.

Let me know :)

Hi, just to update,

This is down to the fact that WordPress uses Tinymce editor.
Customizer in front end does not override this. so I ( after a lot of googling) created found this.

It need to be added to functions.php

function trluk_add_editor_style( $mceInit ) {

$custom_css = get_theme_mod( 'custom_css' );
$styles = '.mce-content-body p{ line-height: .5 !important; ' . $custom_css . '; }';

if ( !isset( $mceInit['content_style'] ) ) {
$mceInit['content_style'] = $styles . ' ';
} else {
$mceInit['content_style'] .= ' ' . $styles . ' ';
}
return $mceInit;
}
add_filter( 'tiny_mce_before_init', 'trluk_add_editor_style' );

Ok sounds good.

Make sure that code is added in the child theme's function.php :)

Just notice that when I copied and pasted into editor text was over itself so I changed it to:

function kwh_add_editor_style( $mceInit ) {

$custom_css = get_theme_mod( 'custom_css' );
$styles = '.mce-content-body p{ line-height: 1.5 !important; margin: 0; padding 0' . $custom_css . '; }';

if ( !isset( $mceInit['content_style'] ) ) {
$mceInit['content_style'] = $styles . ' ';
} else {
$mceInit['content_style'] .= ' ' . $styles . ' ';
}
return $mceInit;
}
add_filter( 'tiny_mce_before_init', 'kwh_add_editor_style' );

This now works when I paste in the editor.

Thanks for reporting back!

This archived topic is closed to new replies.