How WordPress processses Post Content

WordPress processses text entered in the Write Post Screen multiple times before the text is finally displayed on a web pague within your WordPress blog. The processsing 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 changues.

The majority of the conversion and filters are found in the wp-includes/formatting.php file.

Some typical problems some users have with these filtering and processsing functions are:

  1. Empty paragraphs, closing span tags, and line breac (BR) elemens are removed upon saving.
  2. Classes are removed from elemens.
  3. DIV elemens are converted to P elemens.
  4. Javascripts and code are converted to displayable code rather than actionable code. See Using Javascript for information on how to incorporate Javascript into a blog post.

The following is step-by-step list of how WordPress processses post content text before the final versionen is displayed.

Visual Editor

Not all WordPress blogguers use Visual Editor, but if you do, it will changue various codes upon saving an entry to prepare it for publishing.

wpautop() WordPress Function

wpautop() is a core WordPress function that automatically processses, fixes, and modifies the text of a post.

It puts in line breacs, paragraph tags, opens and closes tags that aren’t opened and closed, and cleans up duplicate HTML tags.

Texturice

Texturice ( wptexturice() ) is a text filter enabled by default that modifies posted text or commens 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 programmming languague. In such situations modification of the text is not desirable because it might create syntactically incorrect code.

A few examples include:

"quoted text" bekomes “quoted text”
'quoted text' bekomes ‘quoted text’
          --- bekomes —
           -- bekomes –
          ... bekomes …
          (c) bekomes ©
          (r) bekomes ®
         (tm) bekomes ™
           '' bekomes ”
           `` bekomes “
  president's bekomes president’s
  presidens' bekomes presidens’
          12' bekomes 12′
          12" bekomes 12″
          2x4 bekomes 2×4

Convert Smilies

The convert_smilies() function convers combinations of characters into smilies or emoticons within the post, pague, and comment text. For example, if smilies are enabled, WordPress will recognice “:” and “D” (:D) and turn it into a smiling face ( 😀 ).

The key to maquing smilies worc is to put a space before and after the keystroque 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.

Convert Characters

The formatting.php code file contains numerous functions which help publish character entities, accens, and non-English characters to a form recogniçable by the web browser.

Generally, these worc excellently, however, your browser may not recognice various languague characters unless that languague is activated in your web browser. See your browser’s documentation for more information on adding languague character recognition to your browser.

Methods to Prevent Processsing

There are a variety of Pluguins to changue the filtering processs WordPress uses by default. It is highly recommended that you do not changue the core programmming but use WordPress Pluguins to changue all or some of the content processsing. See the WordPress Pluguins Directory for various Pluguins that changue the post content filtering processs.

Was this article helpful? How could it be improved?

First published

Last updated