This should help you..
<?php
function remove_images( $content )
{
//Run only on the front page, in your case the homepage
if(is_front_page())
{
//Remove the images
$postOutput = preg_replace('/<img\b[^>]++>/i','', $content);
//Get the first 200 characters only, you can change the number if you want
$postOutput = wp_html_excerpt($postOutput, 200);
return $postOutput;
}
return $content;
}
add_filter( 'the_content', 'remove_images', 100 );
?>
Put this code in your functions.php
file.
Related Posts:
- How would I attach media/images to a post based on a ID stored in a each post’s custom field
- How do I insert a custom field in a user submitted post?
- Add custom Attachment Display Setting for images
- Add a checkbox to post screen that adds a class to the title
- Delete the original big size image after upload and leave only 3 images crunched by media gallery
- Custom Field in Featured image for A particular post
- How do I detach images from posts?
- upload image in a meta box
- How do I use element instead of tags in WordPress post content having webP support?
- I am trying to create a simple frontend form for posting
- Prevent duplicate posts in wp_insert_post using custom fields
- HTML code in Custom field
- Better post meta efficiency?
- upload featured image from front end using wordpress add media button
- Adding a Nav menu to post admin
- Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?
- get_post_custom stripping styling issue
- Change post format using custom field
- set role specific screen options in post summary page
- How to change what the post creation page looks like?
- How can I make existing custom fields easier to edit/add in my theme?
- get custom image size
- How to get only text from wordpress post content?
- Get all images out of the posts content
- how to replace embedded “full” sized images within a post with the “large” ones
- Add custom field automatically (add_post_meta) with value based on number of words of article
- Batch process: remove first image from post content
- how can I put an image in a post with original size
- Understanding and using metaboxes in posts
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Duplicating Table of Contents for Paginated Post
- Load post attached images on a single page site with fancybox
- WP_Query orderby not working with meta_value_num and menu_order
- How do I correctly set up a WP-Query to only show upcoming event-posts?
- Set size for attachments
- I have a site where attachments in the wp_posts table have guid values of guid, how did this happen?
- Is there a way to notify specific users when new posts are published to specific pages?
- Categories list into registration form
- Add a custom meta box in the post options that loads some html code in the header
- Show only posts with images and a fixed amount of posts
- Cannot retrieve a custom RSS field from posts
- How would one change the default url structure of attachments?
- Query Posts by Custom Field
- If statement to check if post has image
- Gather posts into a cart/lightbox and share with another user
- How to I retrieve the ID from the Posts page?
- What are the benefits of setting a “featured image” for a WP blog post?
- update image path with words starting uppercase to lowercase chars
- 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
- Make insterted image point to post url instead of attachment page
- how to give multiple post thumbnails to a post
- How to allow multiple thumbnail upload for Posts?
- Output Post with ACF Fields into other Post
- 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
- Add multiple meta keys to a post at once
- How to get all inline images in post content? [duplicate]
- saving/reading custom field value does not work – no value gets POSTed
- Inserting Media to WordPress Posts
- Author Avatar as default first image
- Link post images to 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 Use Custom Fields With .mp3 Links
- Display content between two dates?
- 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)
- Override WordPress core post-template.php block template
- Site/Post preview is not working on all social media
- Delete media from the post but keep my featured image and post
- Custom Fields – How to get the list of a specific active widget each time it rendered
- Pinterest button shows image options from different posts
- Saving canvas generated image when saving post causes 404 error
- Thumbnails and images in the blog post are not loading
- Modified core/image rendering not showing in posts – only on pages
- Blog images not showing on homepage
- Is there a way to save different data when USER interacts with the same POST?
- How do you update post date (year only) in a separate custom field?
- Integrate video and iframe in a post type gallery
- how to create other sizes of original image in one go wordpress uploads
- Output wp_link_pages as raw url
- Embed image in post from external url
- Is possible to do this from function.php
- get_the_ID() fails the first time, returns a value the second time it’s called
- WordPress Media URLs?
- SQL query to remove first image in all posts
- How can I create a menu items from meta box based on users input
- Attaching global meta to custom fields
- First Custom Post Custom Fields Empty After New Custom Post
- Assign custom class to post content images
- Display a custom field rating system in the front end
- How enter custom post meta or custom field on box post list archive page?
- Import alt text in set_post_thumbnail
- Read more opens attachment
- website images getting corrupt automatically
- Image inside the content is replaced with featured image from my older post