I’m having a problem when i use an ajax function where it is used with this:
This trigger my ajax call every 2 secounds and check if is there is need to update something in the site.
The function works fine, but when i put something like this on functions.php(not only this, but as exemple)
my ajax request runned in window.setInterval start to print this ‘test’, and this ‘echo teste’ is actually outsite the function scope on ‘action:my_function’ in the ajax request.
My problem is that, i receiving outsite commands in my ajax calls.
i’m using wp_die(), wp_send_json_success.. etc
I’m register my functions in the right hooks( they work fine if don’t have a echo ‘test’ or anything in ‘admin_init_hook’)
Has anyone ever seen this happen?