Ticket #16478: 16478.4.patch
File 16478.4.patch, 2.1 KB (added by , 21 months ago) |
---|
-
src/wp-admin/edit-form-advanced.php
536 536 if ( $viewable ) : 537 537 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html( $post->ID ) : ''; 538 538 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('URL:', jQuery(\'#shortlink\').val());">' .546 __( 'Get Shortlink' ) .547 '</button>';548 }549 }550 551 539 if ( $post_type_object->public 552 540 && ! ( 'pending' === get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) 553 541 ) { -
src/wp-admin/includes/post.php
1530 1530 */ 1531 1531 $return = apply_filters( 'get_sample_permalink_html', $return, $post->ID, $new_title, $new_slug, $post ); 1532 1532 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('URL:', jQuery(\'#shortlink\').val());">' . 1540 __( 'Get Shortlink' ) . 1541 '</button>'; 1542 } 1543 } 1544 1533 1545 return $return; 1534 1546 } 1535 1547