the_content() stop images being pulled through

I have created a custom post type to pull through the date, title, thumbnail and content, some of the posts have images and the_content() is pulling through those images and I don't know how to stop it from doing this, Could someone help me with this issue?

My code:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="post">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="col-md-5">
                    <?php echo the_post_thumbnail(); ?>
                </div>
                <div class="col-md-6">
                    <h2><?php the_title(); ?></h2>
                    <h4><?php the_date('jS F Y');?></h4>
                    <?php the_content();?>
                    <a href="<?php echo the_permalink(); ?>">Read More</a>
                </div>
            </div>
        </div>
    </div>
</div>
<?php endwhile; else:?>
    <h2>There are no blog posts</h2>
<?php endif; ?>

Solutions

Add this code to your functions.php

function mdc_remove_img($content) {
    $content = preg_replace("/<img[^>]+\>/i", "", $content); 
    return $content;
}

add_filter( 'the_content', 'mdc_remove_img' );

Similar questions

How to get the same post to not show twice when being pulled with a counter
So I have this as the post counter I am pulling the posts with an include that has this for the loop This does currently work but it seems to show the same post a lot. Is there a way to make sure it never shows the same post? Like a prevention on duplicate posts even though I am using a counter and its posting per every 6th post?
Different style being pulled for link attached to image, causing unwanted layers
I need to update a highly-customized WP website to add a SecureTrust logo and link on the site in a specific location beside other certified seals in the footer. I attempted to insert the JavaScript into the footer.php but it didn't work/wasn't recognized. As a work around I edited the style css to show the SecureTrust logo and then added an anchor...
Open graph metadata isn't pulled on Facebook until after I run that specific link through the debugger
I added open graph meta data to all the posts on a site, however, when I attempt to paste a post link on Facebook, the graph meta information isn't loaded. Then, when I insert the URL into the debugger / linter, it works, both within the debugger and when posting normally on Facebook (which didn't work moments prior). This issue seems to have been ...
Images are not being displayed, but they are clearly being loaded (Javascript Game being hosted on Wordpress)
So here's the deal. I created this Sonic themed "Brick Breaker" style game that I wanted to host on a Wordpress site. Originally the game had 8 JS files, a CSS file and an HTML file but for the purposes of wordpress I threw everything into one file. My first issue was that the JavaScript wasn't loading, but the images were being displayed as static...
Child pages and their featured images are not pulled in the parent page in wordpress
For some reason in Genisis framework, wordpress the following code is not pulling up the child pages and its featured images Thank you.
How to stop images from being wrapped in <p> tags?
I'm trying to stop the WordPress from automatically wrapping <img>s with <p> tags. I've tried this recommended snippet in my functions.php: This doesn't works if an image is the first element in a post or page. When an image comes before any text, the image gets wrapped with <p> tags once again. Any ideas?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy .