WordPress.org

Make WordPress Core

Ticket #14760: 14760-button3.diff​

File 14760-button3.diff​, 1.0 KB (added by sillybean, 6 years ago)

Add page_id= check to Get Permalink button conditional

Line 
1Index: src/wp-admin/edit-form-advanced.php
2===================================================================
3--- src/wp-admin/edit-form-advanced.php (revision 25106)
4+++ src/wp-admin/edit-form-advanced.php (revision )
5@@ -368,7 +368,8 @@
6 <?php
7 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
8 $shortlink = wp_get_shortlink($post->ID, 'post');
9-if ( !empty( $shortlink ) && $shortlink !== get_permalink( $post->ID ) )
10+$permalink = get_permalink( $post->ID );
11+if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )
12     $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
13 
14 if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {