[wp-hackers] ajax to call function in theme

Davit Barbakadze jayarjo at gmail.com
Fri Dec 11 16:46:34 UTC 2009


There's still some inconsistency. Tutorial says: "Note: In WP 2.8, if
a user is not logged in ('wp_ajax_nopriv_my_action'), then GET
requests are ignored (and return -1). This bug was fixed in WP 2.9."

It probably means that for every wordpress with version less then 2.9
wp_ajax_nopriv_my_action hook doesn't work, right for not logged in
users? And then it goes again - next section: "Ajax on the
Viewer-Facing Side ( WordPress 2.6 , 2.7, 2.8 )" and:
"add_action('wp_ajax_nopriv_my_special_action',
'my_action_callback');". At the same time Codex says that: "We need to
send our request to a plugin PHP file. This should be the main plugin
PHP file. In case you want it to be a separate PHP file, bare in mind
that you won't be able to access the Wordpress global variables, e.g.
$wpdb, since separate files have absolutely no visibility to any part
of WordPress at all."

I think having all that together, no new comer will be able to figure
out howto write an ajax call for not logged-in users for WP version
less then 2.9 (current stable release that is).

On Tue, Nov 17, 2009 at 8:40 PM, nunomorgadinho
<nuno.morgadinho at gmail.com> wrote:
>
> I've also updated this in the Codex example that uses Sack. Took me a while
> to figure this so maybe it will help others now.
>
>
> scribu wrote:
>>
>> Finally updated the Codex example, using jQuery.
>>
>> --
>> http://scribu.net
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>
>
> --
> View this message in context: http://old.nabble.com/ajax-to-call-function-in-theme-tp26116790p26393151.html
> Sent from the Wordpress Hackers mailing list archive at Nabble.com.
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Davit Barbakadze


More information about the wp-hackers mailing list