A media ‘item’ has a URL in the wp-posts database that points to the file location.
If you change domain names, you have to adjust all of the occurrences of the old domain name to the new name…including in the wp-posts database for media URLs.
A search and replace plugin (I like “Better Search and Replace”, but there are other choices) will allow you to change any occurrence of www.olddomain.com to www.newdomain.com .
Backup your database first, of course.
Related Posts:
- How can I bulk delete media and attachments using WP-CLI?
- Get all posts (of any post type) an attachment is used in
- Unattaching unlinked images
- How to retrieve alt attribute for an attachment (uploaded image)?
- How to Fix HTTP Error When Uploading Images?
- How to manage attachment relationships for specific posts in WP 3.5+
- How to trigger a refresh in the media modal
- Programmatically adding images to the media library with wp_generate_attachment_metadata randomly fails
- Expanding new Media Uploader in WordPress 3.5
- Uploading Multiple Attachments From Front-End With A Description
- complex restriction of items in media library
- Edit image / Delete image link
- media_sideload_image file name?
- Password protect some uploaded files, so only logged-in users can view them
- How to single click to download image in single post
- Show Post ID in “Find Posts or Pages” box in Media Library?
- Delete attachments from Front end
- Get attachments (get_posts) and WP 3.5 new uploader
- Gel all image from certain post type
- Can i hide the attachments from media which I uploaded from front end?
- Get the attachment URL on single.php
- How to count media attachments?
- Get url from file uploaded in Media Library
- Perform a custom (bulk) action in media view
- How to make a customized “Create Gallery” tab in the ‘Add Media’ window?
- Get the path of the first attached media (single.php)
- Show attached media image if no thumbnail image detected
- How to fetch only media that was already attached to a post/page?
- Audio file’s length (duration) is missing from Attachment Details in Media Library [closed]
- Post edit – Media Library – Only get images from current post
- Attach media to multiple posts
- Where does the gallery shortcode gets its attachments from?
- media ‘path’ issue / concern when bringing files live
- Control attachments menu order with jQuery Sortable
- How do I modify the “Insert Media” lightbox in the admin to only show media items from a category?
- Media library quick/inline edit
- Is it possible to share media files between multiple WordPress sites?
- Open the Attachment Details popup
- How to compress image before inserting to wordpress using wp_insert_attachment function?
- Massive photogallery import
- Proper use of wp_get_attachment_image?
- how to get random media id from media gallery
- Get images attached to a specific page
- the_time() returning wrong date/time (way in the future)
- Gutenberg Block: Image resolution
- WordPress Attachments with old images
- Upload multiple image with media_handle_upload with multiple file field [duplicate]
- Get an image from the media library. Struggling with the code?
- get all images from the wordpress media library with link to the post they are associated with
- How can i set media attachments to the author of the post or page for already existed posts with attachments
- Media item permalink goes to source file instead of attachment.php
- Adding attachment custom field metadata to TinyMCE tag
- wp_get_attachment_image_src calling wrong location
- wp_delete_attachment doesn’t delete image files / doesn’t work
- Removing images deleted from uploads folder, from Media Library
- Setting an image as post header (not featured image)
- Using the GetMediaLibrary() method in python-wordpress-xmlrpc.media, how to iterate over the result?
- WP media attachment location vs permalink
- Removing delete permanently button in uploading files media
- Retrieve ONLY mp3s and set a variable for use in a playlist called by single.php template?
- controlling whether upload is attached to post or not
- Remove attached media
- Is there a way to add Reattach and Unattach links in image gallery?
- How to retrieve images contained in a post
- How to save media-form on custom tab
- Media library only show 2 items per page?
- Bulk delete media by year
- Media library upload hook
- Media library to list images only user uploaded
- Protecting direct access to PDF and ZIP unless user logged in (without plugin)
- Open media frame and select an attachment
- How to hide media uploads by other users in the Media menu?
- Give attachments an archive page
- How can I hide media library images from general users?
- Retrieving a custom link on an attachment
- Access to Media Library
- Post Via Email – How to send Attachments with it (e.g. PDF File or JPEG Image)?
- Bulk edit of EXIF data for jpeg images uploaded in the media library?
- How organize uploaded media in WP?
- Large Media Library
- Insert woocommerce products programmatically with featured image and gallery
- Attachment page 404
- Change default selection for “Embed or Link”?
- How can I make an attachment page for pdf uploads?
- Remove delete-attachment button for every media
- Media/attachment urls don’t redirect with fake URL structure
- Echo list attachment size in post
- How do I intercept and modify the functionality of wp_get_attachment_image()?
- How to get thumbnail from post attachment in this loop
- Attachments without images
- Add a word to the first // wp_get_attachment_url // as the subdomain name
- Images not displaying on site or media library
- How to Protect Uploads, if User is not Logged In?
- Get attachment URL from attachment Link in WordPress
- How to split my uploaded media into directories?
- How to retrieve “custom url” from image attachment in wordpress
- What is the most efficient way to retrieve a group of image URL’s from different attachment ID’s of a specific crop size?
- Why some images are not allowed to be edited only for thumbnails?
- How to batch-add image file extension without losing DB refs?
- How to add a column showing real media usage (count) to the media list view?