How to Hide Feature Image of Posts in WordPress?

Posted on Posted in php, wordpress

By default, many wordpress themes e.g. 2017 (twenty-seventeen) show the feature image on the top of the posts. The feature image is defined per post basis and is useful in displaying the thumbnails, but we don’t want to show it above the post.

You could edit the template file, usually content.php and remove the corresponding feature image HTML code e.g. div+img, however, below is a quick and most efficient way of hiding the feature images of all posts in WordPress.

You need to add the following PHP code to the functions.php template e.g. under the child theme. Save the template file and clear any cache if applicable. The feature image will not be displayed anymore.

function wordpress_hide_feature_image( $html, $post_id, $post_image_id ) {
  return is_single() ? '' : $html;
// add the filter
add_filter( 'post_thumbnail_html', 'wordpress_hide_feature_image', 10, 3 );