WordPress.org

Make WordPress Core

Ticket #16477: 16477.diff

File 16477.diff, 2.3 KB (added by solarissmoke, 4 years ago)
  • wp-admin/includes/post.php

     
    11191119function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { 
    11201120        global $wpdb; 
    11211121        $post = &get_post($id); 
     1122        $currently_saved_permalink = get_permalink( $id ); 
    11221123 
    11231124        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); 
    11241125 
     
    11351136                if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) 
    11361137                        $return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n"; 
    11371138                if ( isset($view_post) ) 
    1138                         $return .= "<span id='view-post-btn'><a href='$permalink' class='button' target='_blank'>$view_post</a></span>\n"; 
     1139                        $return .= "<span id='view-post-btn'><a href='$currently_saved_permalink' class='button' target='_blank'>$view_post</a></span>\n"; 
    11391140 
    11401141                $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); 
    11411142 
     
    11581159 
    11591160        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>'; 
    11601161        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink); 
    1161         $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink); 
    11621162        $return =  '<strong>' . __('Permalink:') . "</strong>\n"; 
    11631163        $return .= '<span id="sample-permalink">' . $display_link . "</span>\n"; 
    11641164        $return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages. 
    11651165        $return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n"; 
    11661166        $return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n"; 
    11671167        if ( isset($view_post) ) 
    1168                 $return .= "<span id='view-post-btn'><a href='$view_link' class='button' target='_blank'>$view_post</a></span>\n"; 
     1168                $return .= "<span id='view-post-btn'><a href='$currently_saved_permalink' class='button' target='_blank'>$view_post</a></span>\n"; 
    11691169 
    11701170        $return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug); 
    11711171