Issue
Is there anyway to detect if the current server operation is currently an AJAX request in WordPress?
For example:
is_ajax()
Solution
Update: since WordPress 4.7.0 you can call a function wp_doing_ajax(). This is preferable because plugins that "do Ajax" differently can filter to turn a "false" into a "true".
Original answer:
If you're using Ajax as recommended in the codex, then you can test for the DOING_AJAX constant:
if (defined('DOING_AJAX') && DOING_AJAX) { /* it's an Ajax call */ }
Answered By - webaware
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.