Is Ajax in WordPress

后端 未结 7 986
萌比男神i
萌比男神i 2021-01-03 17:23

Is there anyway to detect if the current server operation is currently an AJAX request in WordPress?

For example:

is_ajax()
相关标签:
7条回答
  • 2021-01-03 18:20

    I personally prefer the wp_doing_ajax(), but here is another example that should do it.

    if( true === strpos( $_SERVER[ 'REQUEST_URI' ], 'wp-admin/admin-ajax.php' ) ) {
        // is doing ajax
    }
    
    0 讨论(0)
提交回复
热议问题