[wp-hackers] Pre-run `the_content` filters
mark.wordpress at txfx.net
Mon Jun 27 22:33:55 GMT 2005
I'd like to propose that the dormant `post_content_filtered` post be put
to use in the WordPress core for 1.6. There are plugins to harness it,
but they are complicated, buggy, and unreliable, due to the complex
nature of the path that entry content follows as it is processed.
Here is what I propose:
The 'the_content' filter should be run as usual, for backwards compat.
This will be the "live" filter. An additional filter,
'the_content_prefiltered' or some such thing should be run on post
save/publish/edit or created on the fly if it the
`post_content_filtered` column is empty. All existing 'the_content'
filters in WordPress would be moved to this filter, as stuff like auto
paragraphs and curly quotes can be done ahead of time.
With default WordPress setup, this won't speed things up that much. But
things like Markdown or Textile2 would benefit immensely, were they to
use the "prefiltered" hook. I had to disable the acronym plugin because
it was slowing things down too much. Going through an array of 100-200
acronyms and running 100-200 regexes on each post is really a drag.
There is no need to do this every time a post is displayed! Filters
that need to be run live can still do so, by staying hooked to "the_content"
This would be backwards compatible, with benefits increasing as plugin
authors upgraded their plugins.
TextPattern does this, storing a Textile2 processed version of the post
in the DB. Storage is much cheaper than processing. Most post tables
are only a few MB anyway.
The bottom line is this: you can do some amazing stuff with the
'the_content' filter, but you are limited in that it has to be done on
the fly. I think this would be a great way to make 1.6 faster that
18.104.22.168... always a perk.
Can anyone think of any reason why we shouldn't do this?
- Mark Jaquith
More information about the wp-hackers