您可以通过挂接save\\u post操作并更新特色图像自定义字段轻松完成此操作。在您的功能中。php文件,添加以下代码:
function interit_featured_image( $post_id ) {
// Get Parent ID
$parent_id = wp_get_post_parent_id( $post_id );
// Only proceed if this page has a parent
if ($parent_id != 0) :
// Get Parent Thumbnail
$parent_thumbnail = get_post_meta( $parent_id, \'_thumbnail_id\', true );
// Get Parent Caption Data (for the other plugin)
$parent_caption = get_post_meta( $parent_id, \'_cc_featured_image_caption\', true );
// Set Thumbnail
update_post_meta( $post_id, \'_thumbnail_id\', $parent_thumbnail );
// Set Caption (again, for the other plugin)
update_post_meta( $post_id, \'_cc_featured_image_caption\', $parent_caption );
endif;
}
add_action( \'save_post\', \'interit_featured_image\' );