diff --git a/class-wp-front-end-editor.php b/class-wp-front-end-editor.php index da28c13..831fd8d 100644 --- a/class-wp-front-end-editor.php +++ b/class-wp-front-end-editor.php @@ -60,19 +60,27 @@ public static function edit_link( $id ) { if ( $id == get_option( 'page_on_front' ) ) - return home_url( '?editing' ); + $link = home_url( '?editing' ); $permalink = get_permalink( $post->ID ); if ( strpos( $permalink, '?' ) !== false ) - return add_query_arg( 'edit', '', $permalink ); + $link = add_query_arg( 'edit', '', $permalink ); if ( trailingslashit( $permalink ) === $permalink ) - return trailingslashit( $permalink . 'edit' ); + $link = trailingslashit( $permalink . 'edit' ); - return trailingslashit( $permalink ) . 'edit'; + if ( ! isset( $link ) ) + + $link = trailingslashit( $permalink ) . 'edit'; + + if ( force_ssl_admin() ) + + $link = set_url_scheme( $link, 'https' ); + + return $link; } @@ -182,6 +190,15 @@ public function wp() { return; + if ( force_ssl_admin() + && ! is_ssl() ) { + + wp_redirect( set_url_scheme( get_permalink( $post->ID ), 'https' ) ); + + die(); + + } + if ( ! $post ) wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );