WordPress.org

Make WordPress Core

Ticket #14760: 14760-button.diff

File 14760-button.diff, 866 bytes (added by sillybean, 8 months ago)

Hide "Get Shortlink" button if no shorter link is available

  • wp-admin/edit-form-advanced.php

     
    368368<?php 
    369369$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : ''; 
    370370$shortlink = wp_get_shortlink($post->ID, 'post'); 
    371 if ( !empty($shortlink) ) 
     371if ( $shortlink !== get_permalink( $post->ID ) ) 
    372372    $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>'; 
    373373 
    374374if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {