Assuming I know the image attachment ID, how can I get the post permalink to which is attached (if any) ?
$parent = get_post_field( 'post_parent', $id);
$link = get_permalink($parent);
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
3 years ago