Avoid infinite loop when getting attachment link.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-12-12 22:50:54 +00:00
parent 4ea0406712
commit 6c31c17921

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