-
you’re requesting index.php which I guess it’s the homepage; if I call for example is_category() trough your ajax from the category page I’ll get false because the function is being ran on the homepage. Use
$_SERVER["REQUEST_URI"]
instead (don’t forget to sanitize it) -
you’re hooking your handler on the
init
action, which I think runs before the post data is set up. Use a different one, likewp
ortemplate_redirect