add warning on slug conflict with trash, props williamsba1, see #11863
git-svn-id: https://develop.svn.wordpress.org/trunk@14446 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
12196261a4
commit
7874be066e
|
@ -1067,7 +1067,9 @@ function get_sample_permalink($id, $title = null, $name = null) {
|
||||||
* @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
|
* @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
|
||||||
*/
|
*/
|
||||||
function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||||
|
global $wpdb;
|
||||||
$post = &get_post($id);
|
$post = &get_post($id);
|
||||||
|
$orig_permalink = sanitize_title($post->post_title);
|
||||||
list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
|
list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
|
||||||
|
|
||||||
if ( 'publish' == $post->post_status ) {
|
if ( 'publish' == $post->post_status ) {
|
||||||
|
@ -1110,6 +1112,18 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $orig_permalink != $post_name_abridged && !$post->post_name ) {
|
||||||
|
//check if post is trashed
|
||||||
|
$orig_ID = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_status='trash';",$orig_permalink));
|
||||||
|
if ( $orig_ID ) {
|
||||||
|
?>
|
||||||
|
<div id="message" class="error">
|
||||||
|
<?php _e('There was a permalink conflict with an item in the trash. <a href="edit.php?post_status=trash&post_type='.$post->post_type.'">View Trash</a>'); ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
|
$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
|
||||||
$display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
|
$display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
|
||||||
$view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
|
$view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);
|
||||||
|
|
Loading…
Reference in New Issue