WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question. When I was on Wordpress 3.0, my ajax function worked. It return good things when I'm log in and log out.

add_action('wp_ajax_my_action', 'my_action_callback'); add_action('wp_ajax_nopriv_my_action', 'my_action_callback');

Now since Wordpress 3.1, I saw wp_ajax_nopriv_my_action is deprecated. So, for a visitor, my ajax function doesn't work.

What is the alternative ajax function for Wordpress 3.1 ? Please

share|improve this question
What gives you the idea it is deprecated? I am not aware of such decisions, I do not see that documented and it is still used in code just fine. – Rarst Jul 7 '11 at 8:58
Just implemented an ajax based plugin yesterday on 3.2 and this hooks are still working without any problem. – rofflox Jul 7 '11 at 9:00
@Rarst Check it out adambrown.info/p/wp_hooks/hook/… – Steffi Jul 7 '11 at 9:28
@Roman your hooks working with nopriv ? Really ? – Steffi Jul 7 '11 at 9:29
@Steffi I havn't done something special here. Just a normal ajax implementation. See in the search for more articles about ajax implementation or ask a new question with your current code. – rofflox Jul 7 '11 at 10:14

Site you referred to is likely being updated in automated fashion. The reason it wrongfully claims that action is deprecated is because:

So action is not deprecated, its functionality is not changed (only the way variable is accessed) and it is fully functional in current WP version.

share|improve this answer
Ah, okay ! Thanks. But why my ajax function works perfectly when I'm log in. But returns -1 when I'm log out ? I use wp_ajax_hello and wp_ajax_nopriv_hello – Steffi Jul 7 '11 at 14:49
@Steffi I have no idea. Ask new question about that and include your code? – Rarst Jul 7 '11 at 14:51
Yep, thanks — Here : wordpress.stackexchange.com/questions/22305/… – Steffi Jul 7 '11 at 15:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.