[wp-hackers] "deprecating" direct calls to wp-config.php

Tiago Relvao trelvao at workmedia.pt
Tue Nov 17 16:54:25 UTC 2009


You already have a js var defined for that: ajaxurl
You just have to use it as yout url.

Tiago


Otto wrote:
> On Tue, Nov 17, 2009 at 10:44 AM, Olivier <autremonde75 at gmail.com> wrote:
>   
>> The issue is with the javascript/jQuery code (client side). If I
>> remove the call the wp-config.php, then when the JS code is generated
>> and added into the html file sent to the client, this php part won't
>> be resolved : <?php echo admin_url("admin-ajax.php"); ?> potentially
>> because admin_url is a function known through the core...
>>
>> That's it, no issue with the server side ajax handling, I don't have
>> anything to change on that front as I am already using the admin-ajax
>> hooking style. The issue is really with the client side and providing
>> the right URL to call which I can't if I don't have a way to get the
>> admin_url resolved.
>>     
>
> Okay, but that makes no particular sense to me. If you're in a plugin
> context, then you don't have to include wp-config. You're already
> running inside WordPress.
>
> Why are you having to include the wp-config.php there? Are you
> generating this through a separate PHP file or something?
>
> How, exactly, are you generating this Javascript right now? How does
> it get included onto the page in question?
>
> -Otto
> Sent from Memphis, TN, United States
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>   


More information about the wp-hackers mailing list