frontend upload return async-ajax.php 302

Recently we moved a site to SSL following popular guidelines.

Everything worked as expected except when it comes to uploading images via the frontend.

Trying to upload an image we get the following response:

302 POST async-ajax.php
200 GET https://example.com/wp-login.php?redirect_to=https://example.com/wp-admin/async-upload.php&reauth=1

So image upload fails, cookie is invalidated (reauth=1), user is forced to login again.

Other observations:

  1. Users are able to upload images via backend
  2. There is no errors in wp-debug
  3. It works fine if we revert to non-ssl

1 Answer
1

If you are using custom front-end registration through wp_signon function, check, if the second parameter, passed to that function is true:

$user_signon = wp_signon( $info, true ); ).

The second parameter tells WordPress to set the secure cookie for login. It works fine with SSL.

Leave a Comment