Added check for 'admin-ajax.php'

Added condition for admin-ajax.php in case an ajax call is made.
Put add_action back

Put add_action calls back
Removed add_action

Moved add_action back to previous location