diff --git wp-admin/includes/post.php wp-admin/includes/post.php
index 774bd1ea34..f237965bd9 100644
--- wp-admin/includes/post.php
+++ wp-admin/includes/post.php
@@ -1341,12 +1341,6 @@ function get_sample_permalink( $id, $title = null, $name = null ) {
 	$original_date   = $post->post_date;
 	$original_name   = $post->post_name;
 
-	// Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published.
-	if ( in_array( $post->post_status, array( 'draft', 'pending', 'future' ) ) ) {
-		$post->post_status = 'publish';
-		$post->post_name   = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID );
-	}
-
 	// If the user wants to set a new name -- override the current one.
 	// Note: if empty name is supplied -- use the title instead, see #6072.
 	if ( ! is_null( $name ) ) {
diff --git wp-includes/link-template.php wp-includes/link-template.php
index 4d47a8fae4..5d07f3f277 100644
--- wp-includes/link-template.php
+++ wp-includes/link-template.php
@@ -165,7 +165,10 @@ function get_permalink( $post = 0, $leavename = false ) {
 	 */
 	$permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
 
-	if ( '' != $permalink && ! in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) {
+	if ( ( '' != $permalink && ! in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) || $sample ) {
+		if ( $sample ) {
+			$post->post_name = sanitize_title( $post->post_name ? $post->post_name : $post->post_title, $post->ID );
+		}
 
 		$category = '';
 		if ( strpos( $permalink, '%category%' ) !== false ) {
