[wp-hackers] Replacing Hooks/Functions

Andy Skelton skeltoac at gmail.com
Mon Jul 3 22:05:53 GMT 2006


On 7/3/06, David Chait <davebytes at comcast.net> wrote:
> Well, yeah -- depends on what he wants.  If he wants to generate 'content on
> the fly', that is then processed as if it came from the db, he wants it
> highest.  If he wants to nuke all other content processing (note, that
> includes WP-core stuff...) then he wants it lowest.

To answer an earlier question on this thread: "Priority" is a
misnomer. It's actually "order." Lower-numbered filters/actions go
first.

To clarify something said earlier about the_content(), which is a
template tag: the_content() calls get_the_content(),
apply_filters('the_content', $content) and then echo; it has no return
value. get_the_content() returns a string from the global variable
$post with no filters applied.

You can modify the $post variable all you like, but there are not any
logical hooks in place for that because that variable is set by
the_post() which is a sacred template tag used in the most religious
way by devout theme designers. Ain't no hooks for that.

If you look deep into query.php you'll find a filter called the_posts.
This is where you'll find the juiciest, most freshly-squeezed posts
just after they've been plucked from the db. If you use this filter,
please check context very thoroughly before distributing your code.
You probably don't want to affect EVERY query, such as for secondary
loops used by plugins and widgets.

Cheers,
Andy


More information about the wp-hackers mailing list