[Resolved] Remove featured image from single custom post stopped working

Home Forums Support [Resolved] Remove featured image from single custom post stopped working

Home Forums Support Remove featured image from single custom post stopped working

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #328364
    Daniel
    /* 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?

    #328438
    Tom
    Lead Developer
    Lead Developer

    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);
        }
    }
    #328444
    Daniel

    That’s exactly what happened!

    Thanks Tom.

    #328445
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

    #379493
    Daniel

    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

    #379644
    Tom
    Lead Developer
    Lead Developer

    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' );
        }
    }
    #380037
    Daniel

    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

    #380427
    Tom
    Lead Developer
    Lead Developer

    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 ๐Ÿ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.