Site logo

Archived topic

Remove featured image from single custom post stopped working

7 replies · Started by Daniel on June 4, 2017

Viewing posts 1–8 of 8
/* Remove featured images from Tutorials post type */
add_action( 'wp','generate_remove_tutorial_featured_images' );

function generate_remove_tutorial_featured_images()
{
	if ( is_singular('tutorial') ) {
	    remove_action('generate_before_content','generate_featured_page_header_inside_single', 10);

	}
}

I had been succesfully using this to remove the featured image from my 'tutorials' custom post type but it has stopped working since 1.3.46

What is the current recommended way of filtering the featured image out?

Maybe you activated the Page Header add-on? If so, you would have to do this:

add_action( 'after_setup_theme','tu_remove_featured_image_cpt' );
function tu_remove_featured_image_cpt() {
    if ( is_singular('tutorial') ) {
        remove_action('generate_before_content','generate_page_header_inside', 10);
    }
}

That's exactly what happened!

Thanks Tom.

You're welcome :)

Tom,

On the latest plugin update the featured images now display again! No changes to my functions.php code nor anything else.

Has there been a change in the header hooks with the update?

Dan

Ah yes, the function name changed in the Page Header re-write.

This should work now (and forever):

add_action( 'wp', 'tu_remove_featured_image_cpt', 15 );
function tu_remove_featured_image_cpt() {
    if ( is_singular('tutorial') ) {
        remove_action( 'generate_before_content','generate_page_header' );
    }
}

Thanks Tom,

It would be good at some point to fix and keep things like this so that they don't break on upgrades.

Dan

The Page Header add-on was completely re-written in GPP 1.4, so things like this can happen. Shouldn't happen again now that it's re-written :)

This archived topic is closed to new replies.