You can look into this post: http://ken.ph/first-image-of-wordpress-post-as-thumbnail/
Or if you’re comfortable with MySql try using this (obviously check it on local database first):
INSERT into wp_postmeta (meta_value, meta_key, post_id)
SELECT DISTINCT(ID), post_type , post_parent
FROM wp_posts
WHERE post_type="attachment"
AND post_parent !=0
AND post_status="inherit";
UPDATE wp_postmeta set meta_key = '_thumbnail_id'
WHERE meta_key='attachment'
Related Posts:
- WordPress doesn’t Load JQuery Now? Do I need to enqueue JQuery also?
- Why won’t my scripts load?
- I can’t enqueue my scripts – They literally aren’t being added to my site
- Scripts not loading when using the wp_enqueue_scripts action
- Load scripts for do_shortcode( ‘ [ my_shortcode ] ‘ )
- wp_enqueue_script() not working
- How to force one script to load before google tag manager script
- Auto updating JavaScript dependancy in functions.php
- Loading newest dependency javascript module file in functions.php
- Ajax call always returns 0
- plugins_url vs plugin_dir_url
- Where and how to put inline js in pages
- Is it possible to remove the “standard” post format?
- Show modified time if post is actually modified
- Hourly Routine Not Firing ( wp_schedule_event() )
- Warning/Notice about functions.php
- Is checking whether the blog is installed necessary?
- echo or print_r in an admin function
- Overriding methods in a child theme
- Automatically Add Specified Value to Attachment Metadata upon Upload
- WP disobeys disabling of the posts revision feature
- How do I deactivate a plugin for some roles
- How to display more audio file ID3 tags in WordPress
- Running CRON on Server with WP Function
- Using separate .php file for functions – how to run on site?
- wp_trash_post function to only apply to posts, not pages!
- Adding widget to dashboard with wp_dashboard_setup not working
- Access Plugin data from Functions.php
- Using Schema with `the_excerpt`
- Image rotation fails to regenerate custom sized thumbnail
- Register and load scripts
- Having a Function Inside of the Loop
- how to call a function only in specific pages and exclude it from other pages
- About cron delete user with meta_key
- Add dynamic links in WordPress custom theme
- Unable to login using username
- How to change the order of Jquery in the footer of my theme?
- Attempt to change jQuery version caused White Screen of Death
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Custom function causes a 503 error after a couple of hours
- How can I show my latest tweet in my wordpress blog?
- register_activation_hook for multiple functions
- add_action template_redirect not working for home page
- Way to store featured image width and height in two separate variables?
- Insert template-part inside the content
- Got white blank page after copying the functions.php to child theme
- Add unique id to Preview URL
- Numbering lines of code with the tag?
- Latest Foursquare Checkin function
- Insert nofollow in a “Powered By” link, except in the homepage [closed]
- Image loading function not working on archive.php template
- Way to redirect all Product Sub Category to its Main category Page?
- what is best way to keep track of changes made in wordpress website? [closed]
- Is this an acceptable practice for WordPress theme development?
- How to use parent theme functions in child theme functions.php file?
- How to change a specific admin label
- Custom image sizes showing in Classic Editor only when upladed directly to post
- How to add extra value to permalink
- Bulk updating a group of WordPress Pages every 10 minutes
- remove_filter function to unhook twentysixteen parent theme function
- Can we have conditional CSS styling?
- Change function without filter hook
- Allow logged in user to view a Page, else send to login screen and then redirect back to Page
- How to add javascript code into Divi child theme?
- Appending „read more” to the excerpt conditionally
- Override plugin function to show invoices even if not logged in
- How To Display Author Popup on Entry Meta (Genesis Framework)?
- Serving cache from multiple domain names
- ACF Filter return value
- How to build two WordPress site using two different themes with same database (No ! I am not taking about multisite network)?
- Why am I losing image quality on my site?
- Replace image attributes for lazyload plugin on image elements with specific class
- Custom shortcode with do_shortcode and substr
- Keep js after reload the page
- Add array of category IDs to global variable?
- Need some Tweak my nextpage Function
- Adding custom field in menu options [duplicate]
- Function the_content
- Edit TinyMCE Button Functionality
- Automatically delete posts based on query
- WordPress Translate Explaination
- functions.php / replacing div’s with new ones?
- How accomplish modification the_content if home/start page?
- Run function from parent on child site
- Search Woocommerce product titles only
- Post variables not displaying correctly in custom function
- Excerpt – First Sentence & Read More
- Show stuff everywhere except single post?
- Replace & with &
- Decimal stripped from metabox number
- How to fix enqueue_styles error for a twenty-seventeen childtheme
- My website is generating weired url parameters of paginated pages
- Logout redirect via page template without confirmation?
- How can I modify or filter this variable in an existing class? (Mai Theme)
- Copy and Modified WooCommerce function is_coupon_valid [closed]
- ENV for WordPress
- How to trigger an update_option
- Printing the value of 2 functions one near the other
- install Segment on WordPress
- WP backend, Show only own comments (give to users who wrote/published/assigned) posts