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?
- How to protect pages with double authentication: password + email (in custom field)
- 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
- Add existing images from Media Library in to custom gallery
- Replace image attributes for lazyload plugin (data-src)
- How do I detach images from posts?
- How do I sort (order) the results from `get_children()`?
- upload image in a meta box
- How do I use element instead of tags in WordPress post content having webP support?
- Prevent duplicate posts in wp_insert_post using custom fields
- 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 embedded image caption
- Paragraphs removed when using get_post_custom()?
- get_post_custom stripping styling issue
- set role specific screen options in post summary page
- How to change what the post creation page looks like?
- Post taxonomy from exif data
- Autoremove empty custom fields
- get custom image size
- How to get only text from wordpress post content?
- how to replace embedded “full” sized images within a post with the “large” ones
- Batch process: remove first image from post content
- Show featured image next to post-teasers in Genesis Framework?
- Duplicating Table of Contents for Paginated Post
- Can I use images as anchor tags with
- 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?
- How to display Common posts from specific Tag & Category with Shortcode
- 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?
- MySql query to get posts with all meta and terms
- List all categories with featured image from post?
- Categories list into registration form
- Add a custom meta box in the post options that loads some html code in the header
- Get all images in post and comments like Twitter before post title
- Query Posts With Over 1000 Views
- Cannot retrieve a custom RSS field from posts
- How would one change the default url structure of attachments?
- Hooking into the post editing screen for an existing page only
- Gather posts into a cart/lightbox and share with another user
- How to rate a post from Admin Side / Manually?
- Thumbnail Image to go in the post aswell
- update image path with words starting uppercase to lowercase chars
- Uploading images in custom post form
- Make insterted image point to post url instead of attachment page
- Get URL from all images in a post
- how to give multiple post thumbnails to a post
- Image behind the post’s title
- Add two custom fields as a default to the “new post” page.
- Add multiple meta keys to a post at once
- Show more than 200 images in one post
- How to get all inline images in post content? [duplicate]
- Hide thumbnail if there is a gallery on the post
- Image on rss feed on post
- How to Featured content with images in home page?
- select post preview image from nextgen gallery
- How to show a featured image inside a post in only 1 single category
- Link post images to post
- How to get the next and previous image title from attachment or gallery?
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- How to exclude native lazy loading from first image in post content?
- Rewrite image links from attachment id to attachment link
- Aligning images in the wp editor not working. How do i get this to work in custom theme?
- unable to write to the database while uploading images
- Pinterest button shows image options from different posts
- Change the size of the featured image for post?
- Saving canvas generated image when saving post causes 404 error
- Post images are not displayed in media library
- Delete attached images from posts
- Blog images not showing on homepage
- Is there a way to save different data when USER interacts with the same POST?
- Schedule image post on download
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- WP_Query sort by meta_value_num or date
- Integrate video and iframe in a post type gallery
- Set featured image on creating new post
- how to create other sizes of original image in one go wordpress uploads
- Creating Ordered Query using Meta_key
- How can I set and update the the_date according to a custom field of the post
- Stop images from being displayed on the front-end of the site
- WP Query between posts custom fields [duplicate]
- get_the_ID() fails the first time, returns a value the second time it’s called
- Relative Image Urls in Posts are starting from root – Not from WordPress Address (URL) at General Settings
- WordPress Media URLs?
- Featured Images link to post parent
- Using Post ID and Page ID in same function
- Apply comment to different post (not the current post) [duplicate]
- How to only allow post to be deleted if custom field doesn’t exist
- Post thumbnail height problem
- Get attachment if matches a variable
- How to detect if an ACF custom-field is really in use?
- Read more opens attachment
- Download button under all images WordPress
- Images being uploaded via WP Media are not attached even they are used by some CPT posts
- how to display the actual size of the picture in post