WordPress.org

Make WordPress Core

Ticket #11863: conflict.5.patch

File conflict.5.patch, 1.6 KB (added by williamsba1, 4 years ago)
  • wp-admin/includes/post.php

     
    10671067 * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. 
    10681068 */ 
    10691069function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { 
     1070        global $wpdb; 
    10701071        $post = &get_post($id); 
     1072        $orig_permalink = sanitize_title($post->post_title); 
    10711073        list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); 
    10721074 
    10731075        if ( 'publish' == $post->post_status ) { 
     
    11101112                } 
    11111113        } 
    11121114 
     1115        if ( $orig_permalink != $post_name_abridged && !$post->post_name ) { 
     1116                //check if post is trashed 
     1117                $orig_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_status='trash';",$orig_permalink)); 
     1118                if ( $orig_ID ) { 
     1119                        ?> 
     1120                        <div id="message" class="error"> 
     1121                                <?php _e('There was a permalink conflict with an item in the trash. <a href="edit.php?post_status=trash&amp;post_type='.$post->post_type.'">View Trash</a>'); ?> 
     1122                        </div> 
     1123                        <?php 
     1124                } 
     1125        } 
     1126 
    11131127        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>'; 
    11141128        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink); 
    11151129        $view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink); 
     
    11981212 
    11991213        $now = time(); 
    12001214 
    1201         update_post_meta( $post->ID, '_edit_lock', $now );       
     1215        update_post_meta( $post->ID, '_edit_lock', $now ); 
    12021216} 
    12031217 
    12041218/**