Delete code left over from textarea in WordPress • WordPress Help

 learn html

The tag HTML textarea is a great way to show a list long content without your input being extended to infinity because it restricts the content of the text contained in it to a box in which you define the width and length of it. The problem is that adds codes to spare that you certainly do not want to show .

That is, if you enter a textarea let's say, like this:

WordPress shows you a trick of this style, with lots of paragraph tags ( p ), line breaks ( br ) and others HTML codes that are not in the original text and that, of course, you do not want to be seen

 dirty textarea

dirty textarea

If you want to fix it, it's simple, just add this to your function plugin or file functions.php of your active theme, save the changes and you will not have any more leftover codes in your text area :

You get a textarea clean from crap …

 clean textarea

clean textarea

If you follow WordPress Help and you have really looked at the code, what we're really doing is replacing text with str_replace so that when you find an unwanted element it replaces it with a blank space, something similar to what we have already done for, for example, change the WordPress greeting without modifying the translation remove HTML from comments replace some words with others (precious and useful for many things) and many other tricks that we have already seen. [19659005] Another possibility is to deactivate the wpautop at will or try the plugin PS disable auto formatting but I personally find the previous method better, and it works always

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you: