将下面的代码添加到您的当前主题的 functions.php 文件:
// This is the confirmation message that will appear.
$c_message = 'Are you SURE you want to publish this post?';
function confirm_publish(){
global $c_message;
echo '<script type="text/javascript"><!-- var publish = document.getElementById("publish"); if (publish !== null) publish.onclick = function(){ return confirm("'.$c_message.'"); }; // --></script>';
}
add_action('admin_footer', 'confirm_publish');
之后,点击发布按钮会有如上图的提示,可以防止误操作。
本文作者为许都,未经作者授权,禁止转载。