WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/04/2015 01:26:08 AM (6 years ago)
Author:
boonebgorges
Message:

After [31114] and [31323], 'View Post' generated in get_sample_permalink_html() should go to pretty permalink.

get_permalink() will return a non-pretty permalink for future posts, which
breaks some user workflows that expect View Post to lead to a page with the
pretty permalink.

Fixes #30910.

File:
1 edited

Legend:

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

    r31896 r32002  
    12951295        $post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
    12961296        $display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, urldecode( $permalink ) );
     1297        $pretty_permalink = str_replace( array( '%pagename%', '%postname%' ), $post_name, urldecode( $permalink ) );
    12971298
    12981299        $return =  '<strong>' . __( 'Permalink:' ) . "</strong>\n";
     
    13101311            $return .= "<span id='view-post-btn'><a href='" . esc_url( $preview_link ) . "' class='button button-small' target='wp-preview-{$post->ID}'>$view_post</a></span>\n";
    13111312        } else {
    1312             $return .= "<span id='view-post-btn'><a href='" . get_permalink( $post ) . "' class='button button-small'>$view_post</a></span>\n";
     1313            if ( empty( $pretty_permalink ) ) {
     1314                $pretty_permalink = $permalink;
     1315            }
     1316
     1317            $return .= "<span id='view-post-btn'><a href='" . $pretty_permalink . "' class='button button-small'>$view_post</a></span>\n";
    13131318        }
    13141319    }
Note: See TracChangeset for help on using the changeset viewer.