修改2个文件:
1. wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php
在 方法public update_item_permissions_check中
//return 前 增加
if((empty($request['featured_media']) and !has_post_thumbnail($request['id'])) or ($request['featured_media']===0) ){
return new WP_Error('custom_error',"请添加特色图片" );
}
2. wp-includes\js\dist\editor.js 修改完成后 压缩并替换到editor.min.js中
在方法function requestPostUpdateFailure(action) 中
var noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_this_wp_i18n_["__"])('Updating failed');
if(error.code=="custom_error"){
noticeMessage+=","+error.message
}