<?php if ( !defined( 'ABSPATH' ) ) exit;//PHPの宣言と直接アクセスの拒否

/* https://www.gavick.com/blog/wordpress-automatically-set-post-featured-image */
function haup_auto_featured_image() {
	global $post;

	if(isset( GetOP01_blocktheme()['default-featured-image'] )){
		$attachment_id= absint(GetOP01_blocktheme()['default-featured-image']);
	}else{
		$attachment_id= '';
	}
 
	if (!has_post_thumbnail(get_the_ID())) {
		set_post_thumbnail(get_the_ID(), $attachment_id);
	}
}
add_action('save_post', 'haup_auto_featured_image');
add_action('draft_to_publish', 'haup_auto_featured_image');
add_action('new_to_publish', 'haup_auto_featured_image');
add_action('pending_to_publish', 'haup_auto_featured_image');
add_action('future_to_publish', 'haup_auto_featured_image');