I'm running a WordPress install and was having issues with ajax-loads. Whenever I used the admin-ajax.php script, it wasn't returning anything so I decided to go to the source and see what the issue is.
It turns out that when I access the /wp-admin/admin-ajax.php file directly, it returns a 0
in the browser. I emptied the file, saved it and then tried to access it directly and it still returned a 0
. I know I'm on the correct server in the correct directory as I created test files in the same DIR.
Does anyone know why this would be happening? A blank php file (with 644 permissions, and the correct owner/group) returning a 0
when navigating to it directly?
EDIT: I have highlighted a sentence above as people are skipping over that part. I have emptied the file, it still returns 0
.
That file can't be accessed directly, it must be accessed through an Ajax call and you must pass in some action parameters, as in the line 28 there is a check:
// Require an action parameter
if ( empty( $_REQUEST['action'] ) )
die( '0' );
Try upgrading your installation to the latest version and check that you file size is larger than 3.75K ... If you have no cache installed than you shouldn't get a 0 from a empty php file. Do you use caching like cloudflare ?
Regarding the returned 0
, try the following code:
<?php
die('Hello');
it should return a simple Hello - on my side it works, at least :)