Make WordPress Core

Ticket #33495: 33495.diff

File 33495.diff, 1.6 KB (added by helen, 9 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    569569<?php
    570570if ( $viewable ) :
    571571$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
    572 $shortlink = wp_get_shortlink($post->ID, 'post');
    573572
    574 if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )
    575     $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>';
     573// As of 4.4, the Get Shortlink button is hidden by default.
     574if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
     575        $shortlink = wp_get_shortlink($post->ID, 'post');
    576576
     577        if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) {
     578        $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>';
     579        }
     580}
     581
    577582if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {
    578583        $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
    579584?>