Make WordPress Core

Opened 2 years ago

Last modified 13 months ago

#23778 reopened defect (bug)

How do you keep WordPress from removing the non-breaking space?

Reported by: spherman Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.0
Component: TinyMCE Keywords: has-patch dev-feedback 3.8-early
Focuses: Cc:


I am hoping you guys have a simple solution for me. I would really appreciate it.

I am doing a lot of porting existing sites to be wordpress sites and I have notived that every time there is a non-breaking space   it removes it fron the code when it is saved or when switching back and forth between visual and text mode.

I have combed google for a solution and come up with nothing but other people complaining about the same thing with no real solution.

Thoughts anyone?

Attachments (2)

23778.diff (528 bytes) - added by MikeHansenMe 19 months ago.
23778.2.diff (504 bytes) - added by MikeHansenMe 5 months ago.
Refreshed patch

Download all attachments as: .zip

Change History (11)

comment:1 @SergeyBiryukov2 years ago

  • Component changed from Text Changes to TinyMCE
  • Version changed from 3.5.1 to 2.0

every time there is a non-breaking space   it removes it fron the code when it is saved or when switching back and forth between visual and text mode.

If you enter   in Text editor and save the post without switching to Visual editor, the non-breaking space will be preserved.

If you don't want to lose your non-breaking spaces by accidentally switching to Visual editor, the only workaround is to disable the Visual editor.

Closing as a duplicate of #2420.

comment:2 @SergeyBiryukov2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #2420.

comment:3 @SergeyBiryukov2 years ago

Actually, this seems to work too:

function allow_nbsp_in_tinymce( $mceInit ) {
	$mceInit['entities'] = '160,nbsp,38,amp,60,lt,62,gt';	
	return $mceInit;
add_filter( 'tiny_mce_before_init', 'allow_nbsp_in_tinymce' );

comment:4 @SergeyBiryukov2 years ago

  • Milestone set to Awaiting Review
  • Resolution duplicate deleted
  • Status changed from closed to reopened

The entities element was originally added in [4080].

Not sure why   is not there, we could probably add it.

comment:5 @spherman20 months ago

Bless you!! I went searching for an answer to this once again and found your response. It worked!!!!

@MikeHansenMe19 months ago

comment:6 @MikeHansenMe19 months ago

  • Cc mdhansen@… added
  • Keywords has-patch added

comment:7 @jeremyclarke18 months ago

  • Cc jer@… added
  • Keywords dev-feedback added

+1 for the importance of this issue. Our French authors are driven mad by the inability to add non-breaking spaces, it's like forcing them to use incorrect grammar (they have a lot of punctuation with spaces before the text like "« Salut Jeanne !").

Please lets make WP allow the proper usage of NBSP, especially since it's already allowed as a hack to fake empty paragraphs (it seems this bug doesn't affect NBSP that are on their own line, which is semantically crazy).

I tested the patch and it fixed the problem for me. Hopefully this can get into the next version of WP.

comment:8 @SergeyBiryukov18 months ago

  • Keywords 3.8-early added
  • Milestone changed from Awaiting Review to Future Release

@MikeHansenMe5 months ago

Refreshed patch

Note: See TracTickets for help on using tickets.