Increased CPU load due to admin-ajax.php spam

No there isn’t a way, any more than there is a way to block “spammers” from accessing you home page. I mean you could put all kind of checks, but in the end you will break how sites are supposed to behave which will mean that someone somewhere will not get his content. If all … Read more

wp_ajax function did not call

Finally I’ve found the problem in your code. You’ve forgotten \ on namespace path. class OtherClass{ public function __construct(){ add_action(‘wp_ajax_getItemsByAjax’, array( ‘\Namespace\Common\FooClass’, ‘getItemsByAjax’ ) ); } } I hope it will help you.

Ajax not working properly

Just saw it… …in your HTML, take the action out entirely. We’re not using the HTML to tell the form/submit button what to do, we’re using JS/AJAX for that. <form method=”POST” action=”<?php echo admin_url(‘admin-ajax.php’); ?>” id=”modal-form-ajax” autocomplete=”off”> Should become: <form method=”POST” id=”modal-form-ajax” autocomplete=”off”> Also, instead of targeting the form, target the submit button, so the … Read more

Why is $_REQUEST an empty array in admin-ajax.php?

Here’s the problem: var formData = new FormData(); formData.append( “userfile”, $(this)[0].files[0] ); formData.append( “action”, “vibesoft_files_upload” ); formData.append( “_wpnonce”, vbsoft.nonce_upload ); console.log( formData ); $.ajax({ type: “post”, url: vbsoft.ajax_url, data: formData, Specifically: var formData = new FormData(); Nowhere in the jQuery documentation does it say that data accepts a FormData object for the data parameter: data … Read more