Avoid infinite loop when getting attachment link.

git-svn-id: https://develop.svn.wordpress.org/trunk@4644 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-12-12 22:50:54 +00:00
parent 1b7d2a91d8
commit 0fc7ecbc1d
1 changed files with 1 additions and 1 deletions

View File

@ -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