Make WordPress Core

Ticket #31933: get-shortlink-button.diff

File get-shortlink-button.diff, 1.7 KB (added by pareshradadiya, 10 years ago)

Patch added

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

     
    496496<div class="inside">
    497497<?php
    498498$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
    499 $shortlink = wp_get_shortlink($post->ID, 'post');
    500499
    501 if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )
    502     $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>';
    503 
    504500if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {
    505501        $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
    506502?>
  • src/wp-admin/includes/post.php

     
    13181318                }
    13191319        }
    13201320
    1321         /**
     1321    $shortlink = wp_get_shortlink($post->ID, 'post');
     1322
     1323    if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )
     1324        $return .= '<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>';
     1325
     1326
     1327    /**
    13221328         * Filter the sample permalink HTML markup.
    13231329         *
    13241330         * @since 2.9.0