wp_insert_attachment
will insert an attachment post for a given parent post ID and filename. You can write a little script to query for all your posts with the legacy key, get their associated image paths, and call wp_insert_attachment
for each.
Related Posts:
- How do I detach images from posts?
- upload featured image from front end using wordpress add media button
- Errors when uploading images in WP 3.5
- wp-cli post create & media import issues
- Remove Featured Image & All Media Uploaded to the Post
- How to get all inline images in post content? [duplicate]
- Inserting Media to WordPress Posts
- how can display a post on home screen without images
- Site/Post preview is not working on all social media
- unable to write to the database while uploading images
- Post images are not displayed in media library
- Customizing individual images on posts
- WordPress Media URLs?
- How do I insert a custom field in a user submitted post?
- Broken images after importing posts and opening in Gutenberg
- Optimize blog that serves hundred of images and videos
- Images being uploaded via WP Media are not attached even they are used by some CPT posts
- Get all images in post and comments like Twitter before post title
- WordPress Automatic Filename Changer
- Query Posts With Over 1000 Views
- Show only posts with images and a fixed amount of posts
- Issue where WP Featured Image will not display
- Cannot retrieve a custom RSS field from posts
- How would one change the default url structure of attachments?
- Hooking into the post editing screen for an existing page only
- Query Posts by Custom Field
- Redirect to another page using contact form 7? [closed]
- If statement to check if post has image
- Gather posts into a cart/lightbox and share with another user
- How to rate a post from Admin Side / Manually?
- Thumbnail Image to go in the post aswell
- Customize rel=canonical tag for single blog post
- How to I retrieve the ID from the Posts page?
- What are the benefits of setting a “featured image” for a WP blog post?
- Get post ID from a link
- Create a list of posts with topic headdings
- Add field to user meta table in database when link is clicked
- Hide custom metabox value from custom fields
- preg_replace not removed “class”
- update image path with words starting uppercase to lowercase chars
- Get post meta retrieving wrong value
- How to only publish posts with image in it
- Uploading images in custom post form
- Edit multiple custom post types while saving a new or edited post
- Upload attachment from external site
- Make insterted image point to post url instead of attachment page
- Get URL from all images in a post
- Disable posts generated from image uploads
- if in category but only with post meta
- how to give multiple post thumbnails to a post
- Display a mixed list of posts and media
- 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?
- Output Post with ACF Fields into other Post
- Image behind the post’s title
- Saving Post Data in Another Database
- 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?
- Add two custom fields as a default to the “new post” page.
- After ajax image is outside the “ tag
- Edit custom fields in posts list
- Add multiple meta keys to a post at once
- Show more than 200 images in one post
- WP_Query custom field pass the post id
- Hide thumbnail if there is a gallery on the post
- Image on rss feed on post
- Change the background of each post according to the category
- If custom field is empty, use one from a previous post
- How to Featured content with images in home page?
- saving/reading custom field value does not work – no value gets POSTed
- Where to insert the other site image url for our wordpress post
- select post preview image from nextgen gallery
- How to show a featured image inside a post in only 1 single category
- Author Avatar as default first image
- Link post images to post
- How to get the next and previous image title from attachment or gallery?
- Why my meta boxes won’t show in front post page?
- 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
- Adding external field to my post form (admin side) and to post show (frontend side)
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- How to call WordPress First Image Post or else Attached Image or Default
- Regarding Posts
- How To Use Custom Fields With .mp3 Links
- Display content between two dates?
- Will multiple category descriptions effect my search engine optimization?
- Automate post update for all posts?
- Changing The Default Header POST Title and Description text by category in wordpress
- How to save template data into wp_post table (post_content column)
- Delete Post but retain image of post [WP REST API]
- Override WordPress core post-template.php block template
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Post picker custom field on page
- How to exclude native lazy loading from first image in post content?
- Rewrite image links from attachment id to attachment link
- Post meta not working