How to Disable Featured Image from Pages Using Astra?

No results found. Try again with different words?

Search must be at least 3 characters.

Disable Featured Image on Posts, Pages, or Other Post Types

Featured images are an important feature for every post, page, or any other post type you have on your website. At the same time, when you add a featured image to your post or page, it will appear on top of your content.

If you want to disable featured images from appearing on your posts, pages, or any other post type, you can add the following custom code to the functions.php file of your Child Theme:

/**
 * Disable Featured image on all post types.
 */
function your_prefix_featured_image() {
 $post_types = array('page','post');

 // bail early if the current post type if not the one we want to customize.
 if ( ! in_array( get_post_type(), $post_types ) ) {
 return;
 }
 
 // Disable featured image.
 add_filter( 'astra_featured_image_enabled', '__return_false' );
}

add_action( 'wp', 'your_prefix_featured_image' );

If you don’t have your Child Theme installed, please check this article on how to do it. 

If you are not sure how to add this code, please check this article.

This code will remove featured images on all of your pages and posts. You can apply this code only to pages, posts, any of your other post types, or all of them by modifying the bolded part of the code above. Here are the examples how this should look like:

  • To remove featured image on all your posts only:
$post_types = array('post');
  • To remove featured image on all your pages only:
$post_types = array('page');
  • To remove featured image on all pages, posts and example custom post type. This is the example which you can use to add any other post types you want the above code to be applied:
$post_types = array('page','post','custom-type-1');

Related Article: How to add PHP Snippets

Was this article helpful?
Did not find a solution? We are here to help you succeed.

Related Docs

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.