summaryrefslogtreecommitdiffstats
path: root/wp-includes/link-template.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/link-template.php')
-rw-r--r--wp-includes/link-template.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 151a986..ef570f2 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -134,7 +134,7 @@ function get_attachment_link($id = false) {
}
$object = get_post($id);
- if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) ) {
+ if ( $wp_rewrite->using_permalinks() && ($object->post_parent > 0) && ($object->post_parent != $id) ) {
$parent = get_post($object->post_parent);
if ( 'page' == $parent->post_type )
$parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front