[wp-hackers] Post content prerendering for WP 1.6

Mark Jaquith mark.wordpress at txfx.net
Wed Aug 17 06:43:25 GMT 2005

As discussed here a few months ago, I'd like to put the 
post_content_filtered column to use in WordPress 1.6

I did preliminary work, and filed a ticked here:

There are three patches against WP 1.6 SVN

To sum up, again:

"the_content" filter remains untouched, and continues to run dynamically 
on each load.  This ensures backwards compatibility for plugins that 
need to be run dynamically.  A new filter is created, called 
"the_content_filtered" which is run when posts are published/edited 
(using the new wp_insert_post() function).  The filter is run in a 
partially simulated post loop environment, so that the global $post 
object and the global $id are both available for plugins that need them 
(this was one of the drawbacks of Preformatted plugin, as these were not 
available at post time).

Displaying of the filtered content hooks in at setup_postdata().  If the 
column is empty (and post_content isn't), the rendered version will be 
created then, on the fly, and inserted into the posts table.  This 
eliminates the need for rebuilds, as posts are rebuilt as they are called.

The benefits of this system will be small on the default WP setup.  
wpautop, wptexturize, convert_smilies and convert_chars aren't very 
expensive.  But as people start adding acronym plugins that iterate 
through hundreds of array elements doing regexes for each one on each 
displayed post, and complex formatting plugins like textile2, this 
should speed things up noticeably.  Sometime last year, I had textile2 
and an acronym plugin running, and my monthly archive pages would max 
out PHP's 8MB of memory... no joke.  Users shouldn't have to choose 
between having a fast load time and having a plethora of useful plugins

I'm posting this on wp-hackers because it's more of a "where WP is 
going" type of topic.

Mark Jaquith
MCincubus @ #wordpress

More information about the wp-hackers mailing list