您可以使用\'wp_insert_post_data\'
筛选以将要更新的数据设置为post当前拥有的数据:
add_filter(\'wp_insert_post_data\', \'prevent_post_edit\', 99, 2);
prevent_post_edit ($data, $postarr) {
if ( ! isset($postarr[\'ID\']) || empty($postarr[\'ID\']) ) return $data;
if ( current_user_can(\'edit_files\') ) return $data; // admin can edit posts
// prevent the update only for post and pages, change this according to tour needs
$prevent_types = array(\'post\', \'page\');
if ( ! in_array($data[\'post_type\'], $prevent_types) ) return data;
// get the post how is before the update
$old = get_post($postarr[ID]);
return get_object_vars($old);
}