mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Permalinks: Add pretty permalinks for unattached attachments.
Previously, unattached attachments would have unsightly `/?attachment_id=1` URLs. As we've moved away from attachments being specifically attached to posts, instead being Media items, this has made the unattached URLs a more common occurrence. We can breath easy once more, knowing that the world is a little bit safer from the horror of unnecessarily ugly URLs. Props SergeyBiryukov, wonderboymusic, pento. Fixes #1914. git-svn-id: https://develop.svn.wordpress.org/trunk@34690 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1296,7 +1296,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||
$view_link = get_preview_post_link( $post, array(), $draft_link );
|
||||
$preview_target = " target='wp-preview-{$post->ID}'";
|
||||
} else {
|
||||
if ( 'publish' === $post->post_status ) {
|
||||
if ( 'publish' === $post->post_status || 'attachment' === $post->post_type ) {
|
||||
$view_link = get_permalink( $post );
|
||||
} else {
|
||||
// Allow non-published (private, future) to be viewed at a pretty permalink.
|
||||
@@ -1310,7 +1310,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
|
||||
$return = '<strong>' . __( 'Permalink:' ) . "</strong>\n";
|
||||
|
||||
if ( false !== $view_link ) {
|
||||
$return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $permalink . "</a>\n";
|
||||
$return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $view_link . "</a>\n";
|
||||
} else {
|
||||
$return .= '<span id="sample-permalink">' . $permalink . "</span>\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user