Restrict Default Image to One Post Type
-
This is a solution I’m sharing since I couldn’t find a direct answer.
GOAL: Restrict the default image to a single post type
I modified code from janw.oostendorp, and it works. I’m adding it for future searchers.
function dfi_custom_posttypes( $dfi_id, $post_id ) { $post = get_post( $post_id ); // remove null featured image ID for all post types except "post" if ( $post->post_type !== 'post' ) { return null; // return no image selection. } return $dfi_id; // the original featured image id } add_filter( 'dfi_thumbnail_id', 'dfi_custom_posttypes', 10, 2 );I’m not an advanced programmer, so if there’s a better way, please let me know.
Thanks for the great plugin.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Restrict Default Image to One Post Type’ is closed to new replies.