WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#23778 reopened defect (bug)

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

Reported by: spherman Owned by:
Priority: normal Milestone: Awaiting Review
Component: TinyMCE Version: 2.0
Severity: normal Keywords:
Cc:

Description

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?

Change History (4)

comment:1 SergeyBiryukov3 months 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 SergeyBiryukov3 months ago

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

Duplicate of #2420.

comment:3 SergeyBiryukov3 months 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 SergeyBiryukov3 months 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.

Note: See TracTickets for help on using tickets.