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
By posting your answer, you agree to the
terms of service.
2 years ago