[wp-hackers] How do filters access variables outside of their function?
Andrew Nacin
wp at andrewnacin.com
Fri Aug 27 01:51:42 UTC 2010
On Thu, Aug 26, 2010 at 8:52 PM, Ken <Ken at adcstudio.com> wrote:
>
> Thanks Nacin,
>
> I was just wondering because the without making them global it still
> worked! (I did global them to make the notices go away, I was just surprised
> is all. Still can't understand why it worked.)
The one that requires $post->post_date needs global $post to work.
Otherwise, the instances of $post_ID are actually get_permalink( $post_ID ).
get_permalink() would thus be receiving a null value, which means it acts on
whichever post is currently being queried. So I imagine it should mostly
work fine.
More information about the wp-hackers
mailing list