diff --git src/wp-admin/includes/post.php src/wp-admin/includes/post.php
index 1968e96..0eb4e0c 100644
|
|
function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { |
1308 | 1308 | |
1309 | 1309 | $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>'; |
1310 | 1310 | $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, urldecode( $permalink ) ); |
1311 | | $pretty_permalink = str_replace( array( '%pagename%', '%postname%' ), $post_name, urldecode( $permalink ) ); |
1312 | 1311 | |
1313 | 1312 | $return = '<strong>' . __( 'Permalink:' ) . "</strong>\n"; |
1314 | 1313 | $return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n"; |
… |
… |
function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { |
1324 | 1323 | $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ); |
1325 | 1324 | $return .= "<span id='view-post-btn'><a href='" . esc_url( $preview_link ) . "' class='button button-small' target='wp-preview-{$post->ID}'>$view_post</a></span>\n"; |
1326 | 1325 | } else { |
1327 | | if ( empty( $pretty_permalink ) ) { |
1328 | | $pretty_permalink = $permalink; |
| 1326 | if ( 'publish' === $post->post_status ) { |
| 1327 | // View Post button should always go to the saved permalink. |
| 1328 | $pretty_permalink = get_permalink( $post ); |
| 1329 | } else { |
| 1330 | // Allow non-published (private, future) to be viewed at a pretty permalink. |
| 1331 | $pretty_permalink = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, urldecode( $permalink ) ); |
1329 | 1332 | } |
1330 | 1333 | |
1331 | 1334 | $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>$view_post</a></span>\n"; |