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
- removing inline styles from wp-caption div
- How can you change the ‘Insert into Post’ title in the media button?
- How to get Images included in Post
- Find the post an attachment is attached to
- Update all posts automatically when using post_meta
- Unattaching images from a post
- how to display post content without post image?
- Add custom field to all posts in specific category
- meta_box or custom_field as a second tinymce post-instance?
- Create A Metabox For A Custom Field
- Load post content into div with ajax
- Add an image box besides featured image?
- Sanitizing `wp_editor();` Values for Database, Edit, and Display
- Remove inline width from figure
- How to add a custom field after wp post
- Custom fields on a virtual page
- What Is meta_id In wp_postmeta?
- Get a custom field of all posts on current blog page
- Remove permalink from images when inserting into post
- Only display posts after current date
- How can I get a post field value using javascript?
- Automatic value for custom fields for posts
- Copying and pasting emoji in a wordpress post
- Guest Author – How to display posts on /author/ archive page
- Featured Image uploaded, attached and set but only appearing in the media library
- Get all attachment by post excluding featured and content inside
- Get attachments for posts that belongs to a specific category
- WordPress Automatic Filename Changer
- Issue where WP Featured Image will not display
- Redirect to another page using contact form 7? [closed]
- 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”
- Upload attachment from external site
- Disable posts generated from image uploads
- if in category but only with post meta
- Images showing up in Post Editor, but not in Published Post
- Image behind the post’s title
- Saving Post Data in Another Database
- How to retrieve certain number of images from a wordpress post?
- After ajax image is outside the “ tag
- Edit custom fields in posts list
- WP_Query custom field pass the post id
- Change the background of each post according to the category
- If custom field is empty, use one from a previous post
- Where to insert the other site image url for our wordpress post
- Why my meta boxes won’t show in front post page?
- How to change the order of elements within a post?
- How to call WordPress First Image Post or else Attached Image or Default
- Regarding Posts
- Automate post update for all posts?
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Post meta not working
- Adding an option to post editor to show a site disclaimer or message
- How do I fix broken links to images in imported posts’ post_content?
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- Blog featured images disappeared on my homepage
- Center crop the feature image
- ‘posts’ table should not store the absolute image path
- How do I display posts ordered by a date custom field?
- How to show category image if no featured image is set?
- How to make an image appear as a thumbnail in the blog post?
- Connection dropped due to file size
- Manipulating images inside post content
- How can I alternate styling of images in a post? [closed]
- Extracting a TLD from the content and assign to custom field
- How to retrieve a post by inputing the url in a custom field and displaying it on an options page
- Custom fields in normal posts
- Disable Media uploader to users
- Order posts by separate menu order for different sub-categories
- WP Gallery Image Page Issue When 2 galleries share one image
- How to custom sort-out editing-panel fields?
- Delete old post with new post
- get_post_meta property of non object
- Why can’t I see my attachment page information for an image?
- Home page: using custom fields for posts and pages
- Only show posts with image and the correct ammount of posts in loop
- How can to use the players from the Media Widgets in the body of a post to play audio and video files
- Extra Theme – Fit image inside of Featured Post Slider
- How to make a local “scroll to ID” on post?
- Full width images within post content
- website images getting corrupt automatically
- Image inside the content is replaced with featured image from my older post