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

1 Answer
1

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

  • you are looking at page for wp_ajax_nopriv_{$_POST[action]}
  • while in recent WP versions actual code is wp_ajax_nopriv_{$_REQUEST[action]} (also documented on that site).

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.

Leave a Reply

Your email address will not be published. Required fields are marked *