diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 54695159de..912432fbaa 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -65,35 +65,40 @@ add_action( 'admin_footer', '_local_storage_notice' );
/*
* @todo Document the $messages array(s).
*/
+$permalink = get_permalink( $post_ID );
+if ( ! $permalink ) {
+ $permalink = '';
+}
+
$messages = array();
$messages['post'] = array(
0 => '', // Unused. Messages start at index 1.
- 1 => sprintf( __('Post updated. View post'), esc_url( get_permalink($post_ID) ) ),
+ 1 => sprintf( __('Post updated. View post'), esc_url( $permalink ) ),
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __('Post updated.'),
/* translators: %s: date and time of the revision */
5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
- 6 => sprintf( __('Post published. View post'), esc_url( get_permalink($post_ID) ) ),
+ 6 => sprintf( __('Post published. View post'), esc_url( $permalink ) ),
7 => __('Post saved.'),
- 8 => sprintf( __('Post submitted. Preview post'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+ 8 => sprintf( __('Post submitted. Preview post'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ),
9 => sprintf( __('Post scheduled for: %1$s. Preview post'),
/* translators: Publish box date format, see http://php.net/date */
- date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
- 10 => sprintf( __('Post draft updated. Preview post'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+ date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ),
+ 10 => sprintf( __('Post draft updated. Preview post'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ),
);
$messages['page'] = array(
0 => '', // Unused. Messages start at index 1.
- 1 => sprintf( __('Page updated. View page'), esc_url( get_permalink($post_ID) ) ),
+ 1 => sprintf( __('Page updated. View page'), esc_url( $permalink ) ),
2 => __('Custom field updated.'),
3 => __('Custom field deleted.'),
4 => __('Page updated.'),
5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
- 6 => sprintf( __('Page published. View page'), esc_url( get_permalink($post_ID) ) ),
+ 6 => sprintf( __('Page published. View page'), esc_url( $permalink ) ),
7 => __('Page saved.'),
- 8 => sprintf( __('Page submitted. Preview page'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
- 9 => sprintf( __('Page scheduled for: %1$s. Preview page'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
- 10 => sprintf( __('Page draft updated. Preview page'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+ 8 => sprintf( __('Page submitted. Preview page'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ),
+ 9 => sprintf( __('Page scheduled for: %1$s. Preview page'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ),
+ 10 => sprintf( __('Page draft updated. Preview page'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ),
);
$messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now.
@@ -485,7 +490,7 @@ do_action( 'edit_form_before_permalink', $post );
public ? get_sample_permalink_html($post->ID) : '';
$shortlink = wp_get_shortlink($post->ID, 'post');
-$permalink = get_permalink( $post->ID );
+
if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )
$sample_permalink_html .= '' . __('Get Shortlink') . '';
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 6b0454d26a..999902a7e9 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
-$wp_version = '4.2-alpha-31130';
+$wp_version = '4.2-alpha-31131';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.