How can I get rid of the attachment URLs completely?
I don’t want users to have the ability to link an image to the Attachment URL when inserting an image, ever.
I’ve done things in the past like redirect back to the attachment’s parent ID and could even alter it to redirect to the full size file URL but I’d rather get rid of having a permalink for attachments all together.
Does anyone know of a way to disable this via the functions.php file?
The form for the ‘From Url’ tab seems to be pretty much hard-coded, so I don’t think there is away of removing the ‘Link Image To’ field.
However, for the Media Library tab you can remove the link field, with the following:
Are you asking for images that you insert into the post WYSIWYG editor to not have attachment links? Because when you insert an image into a post you have the option of wrapping it in a link or having no link. Is this what you mean?
In the image attached below, you’ll see the link URL box, click the button that says none every time you insert an image. This will work manually, but the code above from Stephen will work if you want this to be automatic.