You can do this using the ‘the_content’ filter:
add_filter( 'the_content', 'insert_featured_image', 20 );
function insert_featured_image( $content ) {
$content = preg_replace( "/<\/p>/", "</p>" . get_the_post_thumbnail($post->ID, 'post-single'), $content, 1 );
return $content;
}
Of course, you can add options to the the_post_thumbnail() function to define which size of thumbnail you’d like to use, etc… http://codex.wordpress.org/Function_Reference/the_post_thumbnail
Related Posts:
- How to replace the_post_thumbnail template tag and show the first inside the post image instead
- Adding schema itemprop image to the_post_thumbnail with filters
- How to show a featured image as current?
- Can I insert the feature image inside the content, after any paragraph?
- Custom image size in the_content loop
- Add filter on certain thumbnail sizes only
- Get featured image from post on RSS feed
- changing size image within the content
- Plugin scans for images in post_content, how about “featured image”?
- How do I set a featured image (thumbnail) by image URL when using wp_insert_post()?
- Filter to remove image dimension attributes?
- How do I get image url only on the_post_thumbnail
- How to get image title/alt attribute?
- How to Fix HTTP Error When Uploading Images?
- apply_filters(‘the_content’, $content) vs do_shortcode($content)
- Add class name to post thumbnail
- How to disable WordPress from creating thumbnails?
- How to retrieve image from URL and set as featured image/post thumbnail
- How to set featured image to custom post from outside programmatically
- How do you remove hard coded thumbnail image dimensions?
- How do you get the post thumbnail size?
- Setting a post’s featured image from an embedded YouTube video
- How to get featured image’s width and use elsewhere in template?
- the_content and is_main_query
- set_post_thumbnail_size vs add_image_size
- Minimum Dimensions Requirement for Featured Image?
- Generate Thumbnails only for Featured Images
- How to get all featured image sizes and their URLs?
- How to Dynamically Resize WordPress Image On-The-Fly (custom field/theme option)
- How to add post featured image to RSS item tag?
- How do I regenerate thumbnails?
- How to appending to the_content using add_filter with custom post type?
- Display thumbnail only if requested size exists
- Delete original image – keep thumbnail?
- the_post_thumbnail responsive srcset not populating with custom image size
- Set custom name for generated thumbnails
- How to wrap an element around an iframe or embed in content automatically?
- Post thumbnail alt title
- Get Featured Image via direct sql query
- Get featured image on Blog Index
- the_post_thumbnail hard cropping not working no matter what
- WordPress Internal @ Mentions
- Can I refresh the thumbnails programmatically?
- How to add multiple image sizes of the same size with add_image_size
- New image size version only for the Featured Image file
- wp_get_attachment_image_src always returns full-sized image
- Get featured image URL by page id
- Removing any and all inline styles from the_content()
- change set_post_thumbnail_size according to post type admin page
- Add Title Attribute to WordPress Image the_post_thumbnail
- Can’t extract and set SVG dimensions
- Where to hook into post content?
- Set Featured Image Front Frontend Form
- Getting Thumbnail Path rather than Image Tag
- Display Category Thumbnail and links in Woo commerce
- Insert Custom HTML After Shortcode
- the_post_thumbnail with lazyload JQ plugin
- Replacing Gutenberg Featured Image control?
- Display Post Thumbnail Without Being Featured Image
- Featured Image of Video from oembed
- oEmbed, thumbnails and wordpress
- wp_get_attachment_image_src() and custom sizes
- Prevent WordPress from cropping GIF files
- Add whitespace between Chinese and other letters
- media_sideload_image generates blank?
- Change WordPress image URLs via filter
- Post thumbnail outside the loop
- What’s the difference between post thumbnails and featured images (if any)?
- Getting custom-sized featured image’s URL?
- What is your take: TimThumb vs. WordPress Thumbnails? The great debate [closed]
- Hook added to the_content seems to be called multiple times
- Get excerpt from $post->post_content
- How to crop thumbnail height to auto with set width
- Retrieve 1st image in post and set it as featured image, when post is saved/updated
- Remove title attribute from images
- Use thumbnail image using url of that image
- Retrieve featured image as object
- Add Class to Specific Paragraph of the_content()
- Showing a placeholder/default img, if no featured image is set
- Re-order media links?
- Multiple featured image thumbnails for post types (Multiple Post Thumbnails plugin)
- Best way to filter featured image text for a custom post type?
- the_post_thumbnail scaling not hard cropping
- Skip posts without a thumbnail in loop
- wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); Getting thumb from wrong loop
- add_filter for specific pages
- Set featured image for multiple posts
- Image uploader with “Set Featured Image” link on front end
- adding an id to the_post_thumbnail
- Featured image size in ADMIN panel?
- Is it possible to remove next-post / previous-post with out creating a custom template?
- Featured image with the same height thumbs returns wrong thumb
- How can I display my featured image correctly inside my single posts?
- How to change the naming of the resized image files
- Featured image upload finished hook
- How to get featured post title & image using JSON API?
- Generate thumbnail for images with the same size as thumbnails
- Set post thumbnail as background
- Display thumbnail only on the very first post in the loop?
- What params are available with the_content filter?