Make WordPress Core

Changeset 14446


Ignore:
Timestamp:
05/04/2010 06:18:35 PM (14 years ago)
Author:
wpmuguru
Message:

add warning on slug conflict with trash, props williamsba1, see #11863

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r14404 r14446  
    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
     
    11081110        } else {
    11091111            $post_name_abridged = $post_name;
     1112        }
     1113    }
     1114
     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
    11101124        }
    11111125    }
Note: See TracChangeset for help on using the changeset viewer.