[wp-hackers] How do filters access variables outside of their function?
Ken
Ken at adcSTUDIO.com
Fri Aug 27 00:52:46 UTC 2010
On 8/26/2010 4:27 PM, Andrew Nacin wrote:
> On Thu, Aug 26, 2010 at 4:13 PM, Ken<Ken at adcstudio.com> wrote:
>
>> For example a function Nacin put together on a thread back in May (found on
>> Google):
>> <snip>
>> Calls both $post_ID and $post->post_date, both of which thro notices with
>> wp_debug turned on.
>>
>> The thing that has me stumpt is that I didn't think variables outside of
>> the function were accessible unless global'd.
>>
>
> You'll need to global both of those. I didn't test, I just copy/pasted from
> core where this runs in global scope.
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.)
More information about the wp-hackers
mailing list