Post URL Dynamic Link wrong value when querying attachment

Hello @Wolfgang,

Thanks for clarifying your point of view here.

This is a rather delicate one in my opinion. What you suggest would directly go against how WordPress has built relationships here, since the post URL of a media (or any other really) item should be the frontend facing page, not the direct link to its source.

This is exactly how get_permalink() functions, requiring you to go with wp_get_attachment_url() instead.
I’m fine with modifying the behaviour of Post URL internally, but I know that I would personally be put off by it since it’s moving the user outside the website (in a way).

Attachment URL was added in 1.2.9.8, but nothing is set in stone.

Edit: Just to add, the Post URL provided for attachment is perfectly correct and valid, as provided by WordPress.

Cheers,