Advertisement
cosmocanuck

Function: Preserve HTML entities in WordPress TinyMCE

Dec 22nd, 2017
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. function my_format_TinyMCE( $in ) {
  2.     // Add some common entities to the default array (copy, reg, trade, service mark, euro, curly quotes, dashes and a few others)
  3.     // The odd entires are the entity *number*, the even entries are the entity *name*. If the entity has no name,
  4.     // use the number, prefixed with a hash (for example, the service mark is "8480,#8480").
  5.     // More entities at: https://dev.w3.org/html5/html-author/charref
  6.     // or search for them here: https://unicodelookup.com
  7.  
  8.     $in['entities'] = '169,copy,174,reg,8482,trade,8480,#8480,8364,euro,38,amp,60,lt,62,gt,160,nbsp,8220,ldquo,8221,rdquo,8216,lsquo,8217,rsquo,8211,ndash,8212,mdash,232,egrave,233,eacute,246,ouml';
  9.     $in['entity_encoding'] = 'named';
  10.     return $in;
  11.    
  12. }
  13. add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement