[wp-hackers] checking if post has shortcode, before header is output?

Otto otto at ottodestruct.com
Mon Oct 26 18:29:47 UTC 2009

On Mon, Oct 26, 2009 at 12:41 PM, Aaron D. Campbell <aaron at xavisys.com> wrote:
> That still doesn't fix the case where more than one query is ran on a page,
> when someone does something like "$myQuery = new WP_Query($params);" you'd
> process the main query, but you wouldn't get any of the shortcodes in the
> custom query.

That's because that is not possible. You're basically wanting to know
the content returned by the query before you ever run the query
itself. Can't be done, because of, you know, time only traveling in
one direction. Damn physicists.

To do this sort of thing, you'd need to use output buffering. Buffer
the whole page, then modify it after the fact, inserting what you want
where you want.


More information about the wp-hackers mailing list