0

I have a problem like this:

every save changes code

<td></td>

to

<td>&nbsp;</td>

which is terrible beacause I have big tables and it makes final code much bigger and changes the height of empty lines.

I tried to change tinymce-advanced.php file by removing code

e=e.replace(/<td>\u00a0<\/td>/g,"<td>&nbsp;</td>")

but it does not help.

How can I disable this?

1 Answer 1

0

Technically, this is an issue with TinyMCE, not with WordPress, but WP does provide a gateway to TinyMCE, which allows you to change settings. Your solution might look something like this:

add_filter ('tiny_mce_before_init', 'wpse303889_tiny_filter');
function wpse303889_tiny_filter ($in) {
  $in['entity_encoding'] = 'raw';
  return $in;
  }

Setting the entity_encoding filter to 'raw' supposedly allows you to get rid of spaces being converted to &nbsp, but I have not tested this.

2
  • Hello. I added this code to class-wp-editor.php and nothing has changed.
    – VanWiel
    May 18, 2018 at 18:53
  • Never change core wp files. You risk breaking stuff and changes will be lost with the first update. This belongs in your theme's functions.php file or in a plugin.
    – cjbj
    May 18, 2018 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.