[wp-hackers] How To Get Completely Processed Body Of Blog Posts?

Otto otto at ottodestruct.com
Thu Aug 19 18:38:59 UTC 2010


On Thu, Aug 19, 2010 at 1:36 PM, Rich Pedley <elfin at elfden.co.uk> wrote:
> On 19/08/2010 19:01, Otto wrote:
>>
>> You can skip the setup_postdata(), the global, the reset...
>>
>> $mypost = get_post(whatever);
>> $content = apply_filters('the_content', $mypost->post_content);
>>
>> Note: Badly made plugins that use shortcodes for inappropriate things
>> will complain at you about doing this. I've seen cases where
>> processing the_content filter will a) Add items to a cart in a
>> shopping plugin,
>
> :P
>
> I fixed it!
>
> well ok I still have a few more things to fix on that side, but I did fix
> that bit specifically!

I wasn't naming names, just giving examples. ;)

Lots of people have made this same sort of mistake. You're not alone.

-Otto


More information about the wp-hackers mailing list