There are a few ways to do this with updates to functions.php as well but the easiest might be to first install Yoast plugin and then use the setting for Attachment URLS that redirect it to the parent post
https://yoast.com/media-attachment-urls/
Related Posts:
- Add custom Attachment Display Setting for images
- How to get Images included in Post
- disable WP automatically inserted line breaks after an image
- Delete the original big size image after upload and leave only 3 images crunched by media gallery
- How do I detach images from posts?
- upload image in a meta box
- How do I use element instead of tags in WordPress post content having webP support?
- How to remove images from showing in a post with the_content()?
- Unattaching images from a post
- upload featured image from front end using wordpress add media button
- How do I create Comma Separated list of attached image ids?
- Add an image box besides featured image?
- Remove image from post also removes photo from media library
- All my inserted images gets a link to the full image even if it is already full size image
- get custom image size
- Remove permalink from images when inserting into post
- How to get only text from wordpress post content?
- Get all images out of the posts content
- how to replace embedded “full” sized images within a post with the “large” ones
- Batch process: remove first image from post content
- how can I put an image in a post with original size
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Comma separated all attached image ID numbers except featured image ID number
- Modify Image Source With The_Content Filter?
- Featured Image uploaded, attached and set but only appearing in the media library
- Load post attached images on a single page site with fancybox
- Format the Layout of Images In The Edit Post Textarea?
- Set size for attachments
- I have a site where attachments in the wp_posts table have guid values of guid, how did this happen?
- CSS: How can I show a photo beyond the template’s column, but contained within the browser window? [closed]
- Get all attachment by post excluding featured and content inside
- wp-cli post create & media import issues
- Get attachments for posts that belongs to a specific category
- Show only posts with images and a fixed amount of posts
- Issue where WP Featured Image will not display
- How would one change the default url structure of attachments?
- If statement to check if post has image
- Gather posts into a cart/lightbox and share with another user
- Remove Featured Image & All Media Uploaded to the Post
- What are the benefits of setting a “featured image” for a WP blog post?
- preg_replace not removed “class”
- update image path with words starting uppercase to lowercase chars
- How to only publish posts with image in it
- Uploading images in custom post form
- Make insterted image point to post url instead of attachment page
- Posts page not showing correct image
- Images showing up in Post Editor, but not in Published Post
- How to allow multiple thumbnail upload for Posts?
- get_children returns older images
- How to display post title inside thumbnail?
- How to remove text and retain in caption image using the_content function
- How to retrieve certain number of images from a wordpress post?
- Change the background of each post according to the category
- Where to insert the other site image url for our wordpress post
- select post preview image from nextgen gallery
- Inserting Media to WordPress Posts
- Author Avatar as default first image
- Attachment image single page
- How to change the order of elements within a post?
- Only show featured image on exerpt and exclude images in post
- How to call WordPress First Image Post or else Attached Image or Default
- Regarding Posts
- how can display a post on home screen without images
- Changing The Default Header POST Title and Description text by category in wordpress
- Site/Post preview is not working on all social media
- Delete media from the post but keep my featured image and post
- Pinterest button shows image options from different posts
- How do I fix broken links to images in imported posts’ post_content?
- Thumbnails and images in the blog post are not loading
- Modified core/image rendering not showing in posts – only on pages
- Blog featured images disappeared on my homepage
- Blog images not showing on homepage
- Center crop the feature image
- ‘posts’ table should not store the absolute image path
- How to show category image if no featured image is set?
- How to make an image appear as a thumbnail in the blog post?
- Integrate video and iframe in a post type gallery
- Manipulating images inside post content
- how to create other sizes of original image in one go wordpress uploads
- Output wp_link_pages as raw url
- How can I alternate styling of images in a post? [closed]
- Embed image in post from external url
- Is possible to do this from function.php
- Update all images url imported from HTML pages
- WordPress Media URLs?
- SQL query to remove first image in all posts
- WP Gallery Image Page Issue When 2 galleries share one image
- Why can’t I see my attachment page information for an image?
- How would I attach media/images to a post based on a ID stored in a each post’s custom field
- Assign custom class to post content images
- Extra Theme – Fit image inside of Featured Post Slider
- Is there any SEO impacts on unattached vs attached images for a post in WordPress?
- Full width images within post content
- Import alt text in set_post_thumbnail
- Broken images after importing posts and opening in Gutenberg
- Search doesn’t display posts with images
- Displaying all images from a WordPress post (including media library)
- How to move all images in a post to a single gallery for a bunch of posts?
- Inside post image title has been posting as a post title on my main post page
- Download button under all images WordPress