Disabling rich text editing eliminates funny looking special characters appearing in web copy where people copy and paste stuff from websites and emails and then paste it straight into woocommerce product descriptions or excerpts.
The paste command in a rich text editor pastes in all the html code from the source eg div tags, spans, classes, styles etc… The superfluous HTML is used in the copied site or email and is not used on your site at all. All it does it bloat your database with redundant code.
Your site may also interpret some of the code differently which presents itself as funny looking characters on the page. If you ever have a new website made and have to import your data… the redundant code may really make a mess.
Therefore, its safer to disable the woocommerce rich text product editor to prevent “accidental” copy and pasting of HTML code. Prevention is far cheaper than a repair!
This function forces all content by shop managers as plain text. The rich text editor toolbars are disabled leaving only the plain text editor as the only edit panel.
Therefore, even if content sourced from elsewhere is pasted into woocommerce product editor, the html code is stripped out leaving just plain text content. The text can be edited afterwards to add in bold text etc… if its need but all the other junk will be removed.
Add to the following code to your functions.php file and always used a child theme to prevent your code from being overwritten by the next wordpress update.
Enjoy!
$user = wp_get_current_user(); if ( in_array( 'shop_manager', (array) $user->roles ) ) { add_filter( 'user_can_richedit' , '__return_false', 50 ); }
0 Comments