0

I have a page on my wordpress site which adds file content to a div using jquery.get. The file being targeted is a wp-admin file. The problem is, since I added SSL certificate this file no longer loads. When I check the file which is actually loaded it appears to be the log in page.

Jquery Code:

jQuery.get('/wp-admin/admin.php/?page=booking.multiuser.5.3/wpdev-booking.phpwpdev-booking-resources&tab=availability&wpdev_edit_avalaibility=<?php echo key($_REQUEST['avail']); ?>/', function(data, status) {
        alert("Data: " + data + "\nStatus: " + status);
}

In the alert box I get status:success but the data: that is loaded is the standard wordpress login page.

I have checked other answers on stackoverflow which suggest trailing slashes are the issue but this has not solved the problem.

Is the site switching protocols to http when calling the jquery? I have read elsewhere that this can be an issue and wordpress will log out a user if an http url is called from https file. How would I check to see if this is happening?

UPDATE: If I browse to the file directly I am also redirected to the log in page, even if I am already logged in.

1

Go to your admin area, general settings, and update your "WordPress Address (URL)" and "Site Address (URL)" field value with https. and then update your permalinks setting, by simply click on "Save Changes" button.

In case if you are not able to login to your admin area also, do this changes directly in your database. To update directly in database open your wp_options table, search for option_name = "siteurl" and changes its option_value with your https URL.

Hope this will help you.

1
  • Haha if only it was that easy! That is the first thing I did when I added the SSL certificate. This is not the answer to the problem. The rest of the website works fine, it is only when accessing wp-admin/admin.php files from the front end that we have the issue. – The Sumo Feb 14 '17 at 17:19
1

The issue was the custom login page we have. $user_verify = wp_signon( $login_data, false ); should be $user_verify = wp_signon( $login_data, true ); - setting the value to 'true' creates a secure cookie. If the cookie is not secure, each time a user tries to access wp-admin files they are logged out.

For details check the [wordpress codex][1] for wp_signon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.