diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 7d142d9..fc52137 100644
a
|
b
|
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
331 | 331 | </div> |
332 | 332 | <div class="inside"> |
333 | 333 | <?php |
| 334 | add_filter( 'get_sample_permalink_html', '_get_sample_permalink_html_shortlink_button', 10, 4 ); |
334 | 335 | $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : ''; |
335 | | $shortlink = wp_get_shortlink($post->ID, 'post'); |
336 | | if ( !empty($shortlink) ) |
337 | | $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
338 | 336 | |
339 | 337 | if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?> |
340 | 338 | <div id="edit-slug-box" class="hide-if-no-js"> |
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index e4866ad..7537ecd 100644
a
|
b
|
function post_preview() { |
1307 | 1307 | |
1308 | 1308 | return $url; |
1309 | 1309 | } |
| 1310 | |
| 1311 | |
| 1312 | /** |
| 1313 | * Append the Get Shortlink button to the sample permalink HTML. |
| 1314 | * |
| 1315 | * This is attached to the 'sample_permalink_html' filter. Do not call this directly in plugins or theme templates. |
| 1316 | * |
| 1317 | * @uses get_sample_permalink_html() |
| 1318 | * |
| 1319 | * @return string The HTML of the sample permalink slug editor. |
| 1320 | */ |
| 1321 | function _get_sample_permalink_html_shortlink_button( $sample_permalink_html, $post_id, $new_title, $new_slug ) { |
| 1322 | $shortlink = wp_get_shortlink($post_id, 'post'); |
| 1323 | if ( !empty($shortlink) ) |
| 1324 | $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
| 1325 | |
| 1326 | return $sample_permalink_html; |
| 1327 | } |