How to Set Featured image In WordPress without Showing it into Post?

I just want to set featured image of my post but don’t want to show it in my post.
How can I do that?

Detailed :
I want to post to show its thumbnail in main page but not to show it when we expend the post ie: Not to show that featured image in post when somebody open that post by clicking Read-More

Read More

Plugin will be great.

Related posts

2 comments

  1. It sounds like you want the thumbnail on archives but not on single post displays, so if you are willing to edit the theme you can just wrap the thumbnail code in if(!is_single()). For example:

    if(!is_single()) {
      the_post_thumbnail();
    }
    

    You could also filter post_thumbnail_html but that is pretty wasteful as the the_post_thumbnail does a lot of work before that filter runs.

    function no_thumb_on_single($html) {
      if (is_single()) {
        return '';
      } else {
        return $html;
      }
    }
    add_filter('post_thumbnail_html','no_thumb_on_single');
    
  2. You could use CSS code in your child themes style.css file to hide it:

    .single .wp-post-image { 
    display: none; 
    }
    

    Replace .wp-post-image with the name of your featured image/post thumbnail class your theme uses.

Comments are closed.