[wp-hackers] Ajax requests, admin-ajax.php and the WP_ADMIN constant
24/7
24-7 at gmx.net
Fri Feb 10 13:55:00 UTC 2012
@Nacin
After re-reading your mail several times, I guess I now understand.
* Check if DOING_AJAX is true, if not: don't do anything
* hook the wp_ajax_* and wp_ajax_nopriv_* actions always
To clarify: I loaded several modules from my functions.php file. In the
bootstrap I used there, I simply divided into modules that I need on the
front-end and other I need on the back end/admin UI. I wrapped the whole
stuff into
a) an if/else is_admin() statement and
b) a /theme_root/admin/module_name_a/files*.php and a
/theme_root/public/module_name_b/files*.php folder
The goal was to avoid possible conflicts between admin and public code. My
"problem" is, that I have several ajax calls in public files, which didn't
work as I already killed them when loading the modules as they were inside
! is_admin().
Last Q: Why do we need WP_Admin set to TRUE on top of admin-ajax.php?
More information about the wp-hackers
mailing list