[wp-hackers] Ajax requests, admin-ajax.php and the WP_ADMIN constant
24-7 at gmx.net
Fri Feb 10 12:28:43 UTC 2012
> I imagine what you are doing is using is_admin() to decide whether or
not you should include a file or attach a hook?
> If that is the case, you could leverage defined('DOING_AJAX'), or simply
always attach the hook (add_action() is very cheap).
So far I couldn't (after a cross file search through core files) get around
what the constant is for. The other problem is that I don't really
understand what you're trying to tell me (english != mother tongue). Are
you saying that the include !is_admin() will trigger a ajax cb fn when it
that is hooked to wp_ajax_nopriv_* when it starts with define(
'DOING_AJAX', true );? Also: What do you mean with the add_action and cheap
Thanks a lot for the exaplanation!
More information about the wp-hackers