Disable featured image on all pages
|
/ Documentation / Disable featured image on all pages

Disable featured image on all pages

Astra has a filter astra_featured_image_enabled which can be used to programmatically enable or disable the featured image.

Here is an example snippet that shows how you can disable the featured image on all the pages by default.

/**
 * Disable featured images for pages.
 * Set the featured image to false if current post type is 'page'
 * 
 * @param  boolean $status True - Enable featured image; False - Disable featured image
 * @return boolean         Featured image status based on the 
 */
function disable_feattured_image_for_posts( $status ) {

	// disable featured image for pages.
	if ( 'page' == get_post_type() ) {
		$status = false;
	}

	return $status;
}

add_filter( 'astra_featured_image_enabled', 'disable_feattured_image_for_posts' );

Note:

Add the above code into the child theme’s functions.php file.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

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

This field is required.

REWIND

YEAR IN REVIEW

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.

Download Free Astra Theme - Modal Popup Form