From f99aa53f680310d9bf5ba82eb7a15df1092cb0ff Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 21 Mar 2008 03:08:22 +0000 Subject: [PATCH] use explicit attachment permalink marker for int names. Props andy. fixes #6280 git-svn-id: https://develop.svn.wordpress.org/trunk@7437 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/link-template.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 029aa2bd88..c12fb1f40e 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -179,8 +179,12 @@ function get_attachment_link($id = false) { $parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front else $parentlink = get_permalink( $object->post_parent ); + if ( ctype_digit($object->post_name) ) + $name = 'attachment/' . $object->post_name; // // is paged so we use the explicit attachment marker + else + $name = $object->post_name; if (strpos($parentlink, '?') === false) - $link = trailingslashit($parentlink) . $object->post_name . '/'; + $link = trailingslashit($parentlink) . $name . '/'; } if (! $link ) {