WordPress processes text entered in the Write Post Panel multiple times before the text is finally displayed on a web page within your WordPress blog. The processing of the text filters out the unwanted code and conforms the text to a form that the browser can interpret. Without attention to detail and familiarity with WordPress's post content filtering, this can cause unwanted changes.
The majority of the conversion and filters are found in the
Some typical problems some users have with these filtering and processing functions are:
- Empty paragraphs, closing span tags, and line break (BR) elements are removed upon saving.
- Classes are removed from elements.
- DIV elements are converted to P elements.
The following is step-by-step list of how WordPress processes post content text before the final version is displayed.
- 1 TinyMCE
- 2 wpautop() WordPress Function
- 3 Texturize
- 4 Convert Smilies
- 5 Convert Characters
- 6 Methods to Prevent Processing
TinyMCE is the editor used by WordPress, known as the Rich Text Editor. Not all WordPress bloggers use it, but if you do, it will change various codes upon saving an entry to prepare it for publishing.
wpautop() WordPress Function
It puts in line breaks, paragraph tags, opens and closes tags that aren't opened and closed, and cleans up duplicate HTML tags.
Texturize (wptexturize()) is a text filter enabled by default that modifies posted text or comments to present a more readable and visually attractive output.
While it creates aesthetically pleasant text, it might create difficulties when posting code examples in a programming language. In such situations modification of the text is not desirable because it might create syntactically incorrect code.
A few examples include:
"quoted text" becomes “quoted text” 'quoted text' becomes ‘quoted text’ --- becomes — -- becomes – ... becomes … (c) becomes © (r) becomes ® (tm) becomes ™ '' becomes ” `` becomes “ president's becomes president’s presidents' becomes presidents’ 12' becomes 12′ 12" becomes 12″ 2x4 becomes 2×4
convert_smilies() function converts combinations of characters into smilies or emoticons within the post, page, and comment text. For example, if smilies are enabled, WordPress will recognize :D and turn it into a smiling face.
The key to making smilies work is to put a space before and after the keystroke combination. If placed up against the text, it will not convert.
If conversion of smilies is not desired, turn it off through the Settings > Writing panel.
formatting.php code file contains numerous functions which help publish character entities, accents, and non-English characters to a form recognizable by the web browser.
Generally, these work excellently, however, your browser may not recognize various language characters unless that language is activated in your web browser. See your browser's documentation for more information on adding language character recognition to your browser.
Methods to Prevent Processing
There are a variety of Plugins to change the filtering process WordPress uses by default. It is highly recommended that you do not change the core programming but use WordPress Plugins to change all or some of the content processing. See the WordPress Plugins Directory for various Plugins that change the post content filtering process.