Make WordPress Core

Ticket #16478: 16478.4.patch

File 16478.4.patch, 2.1 KB (added by sabernhardt, 21 months ago)

refresh, moving shortlink button after filter

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

     
    536536        if ( $viewable ) :
    537537                $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html( $post->ID ) : '';
    538538
    539                 // As of 4.4, the Get Shortlink button is hidden by default.
    540                 if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
    541                         $shortlink = wp_get_shortlink( $post->ID, 'post' );
    542 
    543                         if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) {
    544                                 $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" />' .
    545                                         '<button type="button" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val());">' .
    546                                         __( 'Get Shortlink' ) .
    547                                         '</button>';
    548                         }
    549                 }
    550 
    551539                if ( $post_type_object->public
    552540                        && ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) )
    553541                ) {
  • src/wp-admin/includes/post.php

     
    15301530         */
    15311531        $return = apply_filters( 'get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post );
    15321532
     1533        // As of 4.4, the Get Shortlink button is hidden by default.
     1534        if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
     1535                $shortlink = wp_get_shortlink( $post->ID, 'post' );
     1536
     1537                if ( ! empty( $shortlink ) && $shortlink !== $permalink && home_url( '?page_id=' . $post->ID ) !== $permalink ) {
     1538                        $return .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" />' .
     1539                                '<button type="button" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val());">' .
     1540                                __( 'Get Shortlink' ) .
     1541                                '</button>';
     1542                }
     1543        }
     1544
    15331545        return $return;
    15341546}
    15351547