• I think this is probably a bug, but I’m not sure.

    If you’ve got FORCE_SSL_ADMIN on and are editing a new post in the admin UI (via https), if you hit the Preview button, it creates a http link to the preview page. It seems like it should generate an https link.

    Combined with making the logged_in cookie secure using this

    add_filter(‘secure_logged_in_cookie’,’__return_true’);

    means you can’t preview posts. I hacked around it with this:

    add_filter( ‘preview_post_link’, ‘my_preview_post_link_https’, 10, 2 );
    function my_preview_post_link_https( $link, $post ) {
    if($_SERVER[‘HTTPS’] == ‘on’) {
    return preg_replace(“/^http:/”,”https:”,$link);
    } else {
    return $link;
    }
    }

    but it seems like this shouldn’t be necessary. I guess all this ssl admin stuff is relatively new, but it seems like this is a bug to me.

    Chris

The topic ‘post preview button gives http link even if admin is using https’ is closed to new replies.