diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index cdec03a0c..7d539ba61 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -192,6 +192,10 @@ $side_meta_boxes = do_meta_boxes($post_type, 'side', $post);
ID);
+$shortlink = wp_get_shortlink($post->ID, 'post');
+if ( !empty($shortlink) )
+ $sample_permalink_html .= '
' . __('Get Shortlink') . '';
+
if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->publish_cap ) ) ) { ?>
get_queried_object_id();
+ elseif ( 'post' == $context )
+ $post_id = $id;
+
+ $shortlink = '';
+
+ // Return p= link for posts.
+ if ( !empty($post_id) ) {
+ $post = get_post($post_id);
+ if ( isset($post->post_type) && 'post' == $post->post_type )
+ $shortlink = home_url('?p=' . $post->ID);
+ }
+
+ return apply_filters('get_shortlink', $shortlink, $id, $context, $allow_slugs);
+}
+
+/**
+ * Inject rel=sortlink into head if a shortlink is defined for the current page.
+ *
+ * Attached to the wp_head action.
+ *
+ * @since 3.0.0
+ *
+ * @uses wp_get_shortlink()
+ */
+function wp_shortlink_wp_head() {
+ $shortlink = wp_get_shortlink(0, 'query');
+
+ if ( empty($shortlink) )
+ return;
+
+ echo '';
+}
+
+/**
+ * Send a Link: rel=shortlink header if a shortlink is defined for the current page.
+ *
+ * Attached to the wp action.
+ *
+ * @since 3.0.0
+ *
+ * @uses wp_get_shortlink()
+ */
+function wp_shortlink_header() {
+ if ( headers_sent() )
+ return;
+
+ $shortlink = wp_get_shortlink(0, 'query');
+
+ if ( empty($shortlink) )
+ return;
+
+ header('Link: <' . $shortlink . '>; rel=shortlink');
+}
+
?>