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?
- removing inline styles from wp-caption div
- Add custom Attachment Display Setting for images
- How to protect pages with double authentication: password + email (in custom field)
- How set featured posts using checkbox in post edit screen?
- Add a checkbox to post screen that adds a class to the title
- How to get Images included in Post
- disable WP automatically inserted line breaks after an image
- Find the post an attachment is attached to
- 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
- Post slugs and images cannot have same name?
- 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?
- Convert custom fields to post categories
- Update all posts automatically when using post_meta
- Download external images if post is publish
- How do I sort (order) the results from `get_children()`?
- upload image in a meta box
- Can I load posts via Ajax?
- 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
- How to remove images from showing in a post with the_content()?
- Prevent duplicate posts in wp_insert_post using custom fields
- HTML code in Custom field
- Better post meta efficiency?
- How to show posts rank based on custom field value
- Unattaching images from a post
- how to display post content without post image?
- How to wrap every image in a post with a div?
- upload featured image from front end using wordpress add media button
- Add custom field to all posts in specific category
- Adding a Nav menu to post admin
- meta_box or custom_field as a second tinymce post-instance?
- Change default screen option value for posts per page
- How do I create Comma Separated list of attached image ids?
- 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
- Create A Metabox For A Custom Field
- how to grab first link in post… and of course call it
- Paragraphs removed when using get_post_custom()?
- Load post content into div with ajax
- get_post_custom stripping styling issue
- Change post format using custom field
- set role specific screen options in post summary page
- 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
- SQL query to remove first image in all posts
- Using Post ID and Page ID in same function
- Apply comment to different post (not the current post) [duplicate]
- Order posts by separate menu order for different sub-categories
- WP Gallery Image Page Issue When 2 galleries share one image
- How to only allow post to be deleted if custom field doesn’t exist
- Post thumbnail dependant on category
- How to custom sort-out editing-panel fields?
- Delete old post with new post
- Latest news mini images
- How can I create a menu items from meta box based on users input
- get_post_meta property of non object
- Why can’t I see my attachment page information for an image?
- Home page: using custom fields for posts and pages
- Only show posts with image and the correct ammount of posts in loop
- Attaching global meta to custom fields
- First Custom Post Custom Fields Empty After New Custom Post
- How to Do Custom Fields to Output a Definition List
- Assign custom class to post content images
- Extra Theme – Fit image inside of Featured Post Slider
- Post thumbnail height problem
- Display a custom field rating system in the front end
- Get attachment if matches a variable
- How enter custom post meta or custom field on box post list archive page?
- Is there any SEO impacts on unattached vs attached images for a post in WordPress?
- How to make a local “scroll to ID” on post?
- Full width images within post content
- Import alt text in set_post_thumbnail
- How to detect if an ACF custom-field is really in use?
- Broken images after importing posts and opening in Gutenberg
- Search doesn’t display posts with images
- Read more opens attachment
- Displaying all images from a WordPress post (including media library)
- How to move all images in a post to a single gallery for a bunch of posts?
- Inside post image title has been posting as a post title on my main post page
- Download button under all images WordPress
- website images getting corrupt automatically
- Optimize blog that serves hundred of images and videos
- Image inside the content is replaced with featured image from my older post
- Images and menu links disapearing after saving
- Images being uploaded via WP Media are not attached even they are used by some CPT posts
- Redirection – bulk edit 404s to new tomain
- how to display the actual size of the picture in post
- WordPress portfolio posts: media not displaying if several images
- Set Featured Image of a post
- Is there a way to eliminate flyout menus when adding a post?
- Get featured image thumbnail and inserting into custom field on wordpress posts
- How to delete Full Size options from post Add Media?