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:
parent
4ea0406712
commit
6c31c17921
|
@ -134,7 +134,7 @@ function get_attachment_link($id = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = get_post($id);
|
$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);
|
$parent = get_post($object->post_parent);
|
||||||
if ( 'page' == $parent->post_type )
|
if ( 'page' == $parent->post_type )
|
||||||
$parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front
|
$parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front
|
||||||
|
|
Loading…
Reference in New Issue