WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/15/2013 08:08:06 PM (5 years ago)
Author:
ryan
Message:

wp_get_shortlink() improvements.

  • Return shortlinks for pages and public CPTs.
  • Return shortlinks even when cruft-free links are not enabled.
  • Unit tests

Props sillybean, layotte, cais
fixes #18632
see #14760

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r24955 r25030  
    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 ( !empty( $shortlink ) && $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
Note: See TracChangeset for help on using the changeset viewer.