当前位置:首页>网络教程>在WordPress发布文章时跳出弹窗确认提示方法

在WordPress发布文章时跳出弹窗确认提示方法

很多站长在使用WordPress的时候会遇到没完成编辑就不小心点击了发布按钮,虽然影响不大,但是等发布后可以继续编辑,但是对 ...

很多站长在使用WordPress的时候会遇到没完成编辑就不小心点击了发布按钮,虽然影响不大,但是等发布后可以继续编辑,但是对于一些站长而言,是不能忍受的,那么在WordPress发布文章时跳出弹窗确认提示方法是什么?

在WordPress发布文章时跳出弹窗确认提示方法

下面是实现代码,加入到主题的 php" target="_blank">functions.php 中即可。

//WordPress发布文章弹窗提示

function publish_confirm() {

echo “

<script>

jQuery(document).ready(function($){

$(‘#publishing-action input[name=\”publish\”]’).click(function() {

if(confirm(‘确定现在发布文章吗?’)) {

return true;

} else {

$(‘#publishing-action .spinner’).hide();

$(‘#publishing-action img’).hide();

$(this).removeClass(‘button-primary-disabled’);

return false;

}

});

});

</script>”;

}

//add_action(‘admin_footer-post.php’, ‘publish_confirm’);//文章修改等页面加载

add_action(‘admin_footer-post-new.php’, ‘publish_confirm’);//文章发表页面加载

//add_action( ‘admin_print_footer_scripts’, ‘publish_confirm’ );//所有后台底部加载

给TA打赏
共{{data.count}}人
人已打赏
网络教程

WordPress网站使用SSL的原因是什么?

2022-7-15 18:49:22

网络教程

WordPress程序适合搭建的网站类型有哪些?

2022-7-15 18:49:50

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索