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:
parent
1b7d2a91d8
commit
0fc7ecbc1d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user