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
- How to Protect Uploads, if User is not Logged In?
- How To Retrieve An Image Attachment’s Alt Text?
- Add a menu item to WordPress 3.5 Media Manager
- Enhance Media Manager for Gallery
- Programmatically adding images to media library
- Can I add a Category Metabox to attachment?
- Extend Media Library
- WordPress 3.5: Setting custom “full URL path to files” in the Media Library?
- Delete an attachment in the WP media modal window
- Change attachment filename
- How to get attachment file name not attachment URL
- Upload images to remote server
- How to use taxonomies on attachments with the new Media Library?
- Custom collection in media manager?
- How to show all available images in WP’s media library when using the Polylang plugin?
- Delete Associated Media Upon Page Deletion
- Media library to list images only user uploaded
- WordPress 3.5 Media Manager – add a button
- Get all post attachments except featured image
- getting attachement images src and add classes
- Rendering the uploaded file in a wp.media object
- Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords
- Remove “Insert from URL” link in Media upload – WP 3.5
- Which filters or actions to use after a media upload and delete?
- How do I force WordPress to show most recent version of images in the media library?
- WordPress Media Manager 3.5 – default link to
- Proper way to add a button to the top menu of the media library?
- Getting a taxonomy’s thumbnail url
- Stop WordPress from reserving slugs for media items?
- Check if post has attachments (not image)
- How to cleanly delete attachment but retain original file?
- Changing attachment urls?