WordPress admin-ajax.php now longer works what has changed

I am having issues with some of our users saying they have upgraded or changed theme and then they can no longer access our api.

For instance this user.
http://mindfulnessexercises.com/nature-sounds-woodland-bridalway/

Read More

See the spinning audio player this is their question.

We recently changed our theme to “Headline News,” and found out that the audio shortcode seemed to be not working any more. We are sure that the file from Amazon S3 is working and is in public just like how it’s working using your plugin before.

I cannot understand what has changed and why this may no longer be working for them has WordPress changed anything with the admin-ajax.php file with the new update.

With my plugin i am doing the following.

var sendData = {
    "action": "internal_ajax",
    "Data" : "Data goes here"
}
$.post("' . admin_url('admin-ajax.php') . '", sendData, function(response) {
    console.log(response);
}, 'json');

PHP

function internal_ajax() {

    //set POST variables
    $url = 'https://api.s3bubble.com/main_plugin/single_audio_object';
    $response = wp_remote_post($url, array(
        'method' => 'POST',
        'sslverify' => true,
        'timeout' => 10,
        'redirection' => 5,
        'httpversion' => '1.0',
        'blocking' => true,
        'headers' => array(),
        'body' => array(
            'data' => $_POST['Data']
        ),
        'cookies' => array()
    ));

    if (is_wp_error($response)) {

        $error_message = $response - > get_error_message();
        echo json_encode(
            array(
                "error" => true,
                "message" => $error_message
            )
        );
    } else {

        echo $response['body'];

    }

    wp_die();

}

add_action('wp_ajax_internal_ajax', array($this, 'internal_ajax'));

Has anything changed i am so stuck on how to bug test this because i can set it up on another host provider and i will work fine no issue at all.

Can anyone suggest how i can bug test this, would really really appreciate some help.

Thanks

Related posts