Index: src/wp-admin/includes/post.php =================================================================== --- src/wp-admin/includes/post.php (revision 32764) +++ src/wp-admin/includes/post.php (working copy) @@ -1273,6 +1273,8 @@ if ( ! $post ) return ''; + $orig_permalink = sanitize_title( $post->post_title ); + list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug); if ( current_user_can( 'read_post', $post->ID ) ) { @@ -1306,6 +1308,23 @@ } } + // Permalink conflict error messages. + if ( $new_slug && $new_slug != $post_name_abridged ) { + //error message when editing a permalink + global $wpdb; + $conflicting_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_name = %s;", $new_slug ) ); + if ( $conflicting_post->post_status == 'trash' ) { + echo '

'; + echo sprintf( __( 'There was a permalink conflict with the post "%s" in the trash. %s' ), esc_html( $post->post_title ), 'View Trash'); + echo '

'; + } + }elseif ( $orig_permalink != $post_name_abridged && $_GET['message'] == '6' ) { + //error message on a newly created post + echo '

'; + echo sprintf( __( 'There was a permalink conflict with the post "%s" in the trash. %s' ), esc_html( $post->post_title ), 'View Trash' ); + echo '

'; + } + $post_name_html = '' . $post_name_abridged . ''; $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, urldecode( $permalink ) ); $pretty_permalink = str_replace( array( '%pagename%', '%postname%' ), $post_name, urldecode( $permalink ) );