Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
2  
@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
show 2 more comments

1 Answer

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
1  
@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
add comment

Your Answer

 
discard

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.