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
- What’s the difference between home_url() and site_url()
- WordPress Enqueue for homepage only, functions.php, wp-framework
- Can the new 4.8v text widget visual editor be removed?
- Is it possible to remove the main rich Text box editor?
- Add action hook conditionally – only when home.php in use
- Shortcode producing headers already sent error
- Calling a function from functions.php in header [closed]
- How to use get_media_embedded_in_content function
- Dynamically add sub-categories to any category in the menu
- Is there a way to push javascript or css ‘on-page’ in a template via functions.php
- gform_after_submission content appears immediately after , not in post body [closed]
- Adding Google Analytics to footer selectively
- How to change a certain text or term of WordPress into a custom into the whole site?
- I changed “Howdy” in the admin bar in the dashboard, but when I’m viewing the site it still says Howdy!
- Template tags vs get_template_part() vs functions.php
- Changes to functions.php not working
- Custom excerpt legnths for specific pages
- Custom logo sizes for multiple logos
- How to Add a Random Custom Gravatar in the WordPress Comments?
- how to change link of some wordpress pages
- Add custom image size not working
- When to use an if statement after get_posts?
- Programmatically Create Category and sub Category
- How to mass-delete inline styles in WordPress custom post type automatically?
- Include files in child themes, declare in functions.php
- wp_get_attachment_image function size argument not working if I also add a custom class
- Display first name of logged in user?
- functions.php mistakenly deleted
- Identical custom taxonomy slugs for same hierarchical children
- Shortcode inserts paragraphs before and after executing shortcode
- Get_template_part inside a folder
- Passing values from a widget to a function within a plugin
- Contact Form 7 – Delay auto responds
- add code in functions.php will slow down the Execution speed?
- Custom Post excerpt not working correctly
- Replace a menu with widget or a custom template file programmatically
- Wait a result before enqueue
- Which functions/classes are available during SHORTINIT?
- Function added using `add_action()` not being called
- How to pass variables from a function in functions.php to an other one
- How to set default post editor based on role?
- Author Date Function not working as expected [duplicate]
- Add_filter when value is no variable?
- wp_star_rating() – Adding a 5 star rating system to theme
- How to hide image-url if no attachment?
- Hide thumbnail on search results when thumbnail not set – using Oxygen
- How to properly refresh page after form action?
- Default Nav Highlight
- Using two loops in one WordPress template
- Multiple navigation menu in same location
- WordPress Website with Login system
- Return link pages instead of displaying them
- Adding Read More to Custom excerpts
- Add a custom function to widget code
- Create Custom URL structure for specific Post category using Post ID instead of post name
- Add custom taxonomy using JS in post editor
- WordPress: Highlight search result exact matches
- Custom route and extract data from slashes and parameter
- Exclude specific post from query
- wp_set_object_term via js btn frontend
- How can I show a specific page to admins only?
- Function to function shortcode help [closed]
- Hide author info in single posts by certain users
- Creating a custom functions page wordpress
- search and replace using regex
- post value to function with Ajax and jQuery
- (Divi): How to make WordPress load images of specific size for Blurb modules on given page with a funciton?
- Strip all HTML tags from product content and resave
- Calling hooks in functions
- How do I create a child theme from PowerMag theme
- WordPress Toggle Menu has stopped working
- Echo a String Based On Geolocation? [Woocommerce || ACF]
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- Shortcode with pagination advancing multiple queries
- Author Page User id in functions.php for non login user
- How to add widget in main menu
- TinyMCE Multiple Custom Classes Selections
- Surrond h1 entry-title automatically with a span tag
- update_post_meta not working in function
- Integrate WP Tiles into existing loop (index.php) and theme
- Show the post date using the wp_get_archives() function?
- Why does my visual post editor break when I try to add a TinyMCE button?
- Shortcode to output get_header not working
- Welcome Mails based on user role
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Dynamic body classes based on current page
- Why don’t some template tags work when querying information on single.php?
- Problem with Child-Theme using of foundation-framework [closed]
- add variable to actions/functions across different files (woocommerce)
- How do grab the main loop, with conditions, and output via shortcodes
- replacing words to “…” [closed]