I have implemented ajax in the website

add_action('wp_ajax_wppl_function', 'wppl_function ');
add_action('wp_ajax_nopriv_wppl_function', 'wppl_function');

But this works without any issue if i log out.

This is the error that i am getting the console

component : "Core"
file : "wp-includes/class-wp-hook.php"
line : 286
message : "call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_ajax_wppl_function' not found or invalid function name"
stack : ["do_action('wp_ajax_wppl_function')"]
type : "warning"

Not sure what's happening.


1 Answer 1


A few things that I see:

  1. There's a space in your first add_action declaration. Should be add_action('wp_ajax_wppl_function', 'wppl_function');
  2. Have you declared wppl_function to run it?
  3. Have you localized your scripts when logged in? Please review the codex entry on wp_ajax_nopriv (action)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.