Copyright 2013-2019 All Rights Reserved Theme by设计盒模板网_dedecms织梦模板_ecshop商城_discuz论坛_ThinkPhp框架_完整无错带数据网站模板源码下载
牛图网 牛梦源码 牛梦传媒 牛梦网赚 365云品仓实战团队 懂懂日记 365梦之队博客 牛梦说网赚博客
你有没有不小心误点发布按钮而发表一篇文章吗? 如果你使用了社交类插件,误发布的同时会共享到社交网络上,甚至可能被搜索引擎收录,本文的一段代码将有效防止误操作的发生。
将下面的代码添加到您的当前主题的 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');
之后,点击发布按钮会有如上图的提示,可以防止误操作。