Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jan-Willem

    (@janwoostendorp)

    Hi pipoulito,

    Yes that’s possible

    
    <?php
    
    /**
     * Plugin Name:       Default Featured Image, apply to posts only.
     * Plugin URI:        https://wordpress.org/support/topic/default-for-cpt/
     * Version:           1.0
     */
    
    function dfi_no_page_post( $dfi_id, $post_id ) {
    	$post = get_post( $post_id );
    	if ( $post->post_type === 'page' ) {
    		return 1234; // For Pages set the image with media ID 1234 as the default.
    	}
    
    	return $dfi_id; // the original featured image id
    }
    
    add_filter( 'dfi_thumbnail_id', 'dfi_no_page_post', 10, 2 );

    Adjust the image id (1234 in the example) and replace ‘page’ with your custom post type.

    Let me know how it goes.

    Jan-Willem

    Thread Starter pipoulito

    (@pipoulito)

    thanks a lot

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Default for CPT’ is closed to new replies.