add_action('init', function() {
if (! isset($_REQUEST[ 'photocrati_ajax' ]) || $_REQUEST['action'] !== 'upload_image') {
# not an upload image request so
return;
}
# process upload request here
}, 9);
因爲,在次世代動作M_Ajax :: serve_ajax_request(其不點火)調用exit()後,您無法在NextGen操作之後運行。如果您需要在NextGen操作之後執行操作,那麼您可以先在操作中運行NextGen操作,然後再操作並退出。
add_action('init', function() {
if (! isset($_REQUEST[ 'photocrati_ajax' ]) || $_REQUEST['action'] !== 'upload_image') {
# not an upload image request so
return;
}
# First do the NextGen action M_Ajax::serve_ajax_request() processing
$controller = C_Ajax_Controller::get_instance();
$controller->index_action();
# Now do your image upload processing here
# Finally, must exit otherwise NextGen action will be done twice
exit;
}, 9);
的$ _REQUEST這個樣子的
[photocrati_ajax] => 1
[action] => upload_image
[gallery_id] => 0
[gallery_name] => gallery
[nextgen_upload_image_sec] => 496cc9951b
[name] => image.jpg