Make WordPress Core

Changeset 14124


Ignore:
Timestamp:
04/18/2010 01:46:28 AM (14 years ago)
Author:
dd32
Message:

Display the correct Slug in the permalink preview. Props duck_. Fixes #12870

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r14113 r14124  
    10591059    $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
    10601060    $title = isset($_POST['new_title'])? $_POST['new_title'] : '';
    1061     $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : '';
     1061    $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : null;
    10621062    die(get_sample_permalink_html($post_id, $title, $slug));
    10631063break;
  • trunk/wp-admin/includes/post.php

    r14118 r14124  
    10281028    }
    10291029
    1030     $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
    1031 
    10321030    // If the user wants to set a new name -- override the current one
    10331031    // Note: if empty name is supplied -- use the title instead, see #6072
    10341032    if ( !is_null($name) )
    10351033        $post->post_name = sanitize_title($name ? $name : $title, $post->ID);
     1034
     1035    $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
    10361036
    10371037    $post->filter = 'sample';
  • trunk/wp-includes/link-template.php

    r14099 r14124  
    272272        $post = &get_post($id);
    273273
    274     $pagestruct = $wp_rewrite->get_page_permastruct();
    275 
    276     if ( '' != $pagestruct && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
    277         $link = get_page_uri($id);
    278         $link = ( $leavename ) ? $pagestruct : str_replace('%pagename%', $link, $pagestruct);
     274    $link = $wp_rewrite->get_page_permastruct();
     275
     276    if ( '' != $link && ( ( isset($post->post_status) && 'draft' != $post->post_status && 'pending' != $post->post_status ) || $sample ) ) {
     277        if ( ! $leavename )
     278            $link = str_replace('%pagename%', get_page_uri($id), $link);
    279279        $link = home_url($link);
    280280        $link = user_trailingslashit($link, 'page');
Note: See TracChangeset for help on using the changeset viewer.