I included a file (some-file.php
) in my Ajax callback function. In that file I added some actions:
// some-file.php
add_action('load-post.php', 'function1');
add_action('load-post-new.php', 'function2');
But the functions (function1
and function2
) never executed, however I'm positively sure that some-file.php
is included.
add_action
works perfectly if I called it inside my plugin file directly. I have problem with it when I'm calling it inside my Ajax callback.
Why this happens and how can I fix it?