2

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

7
  • 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, 2011 at 8:58
  • Just implemented an ajax based plugin yesterday on 3.2 and this hooks are still working without any problem.
    – Roman
    Jul 7, 2011 at 9:00
  • @Rarst Check it out adambrown.info/p/wp_hooks/hook/…
    – Steffi
    Jul 7, 2011 at 9:28
  • @Roman your hooks working with nopriv ? Really ?
    – Steffi
    Jul 7, 2011 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.
    – Roman
    Jul 7, 2011 at 10:14

1 Answer 1

6

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.

3
  • 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, 2011 at 14:49
  • 1
    @Steffi I have no idea. Ask new question about that and include your code?
    – Rarst
    Jul 7, 2011 at 14:51
  • Yep, thanks — Here : wordpress.stackexchange.com/questions/22305/…
    – Steffi
    Jul 7, 2011 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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