web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. AIGC工具
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站
    手机应用

wordpress如何防止文章复制(附代码)

588 ℃

wordpress如何防止文章内容被复制,下面web建站小编给大家详细介绍一下实现代码!

找到header.php​模板,在<?php wp_head(); ?>​中新增以下代码:

<script>
// 禁止右键
document.oncontextmenu = function() {
  return false
};

// 禁止图片拖放
document.ondragstart = function() {
  return false
};

// 禁止选择文本
document.onselectstart = function() {
  if (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") return false;
  else return true;
};

if (window.sidebar) {
  document.onmousedown = function(e) {
    var obj = e.target;
    if (obj.tagName.toUpperCase() == "INPUT" || obj.tagName.toUpperCase() == "TEXTAREA" || obj.tagName.toUpperCase() == "PASSWORD") return true;
    else return false;
  }
};

// 禁止frame标签引用
if (parent.frames.length > 0) top.location.replace(document.location);
</script>
Trae:新一代免费的AI编程工具

wordpress网站哪些插件防止文章被盗

利用css3实现禁止文章内容复制

标签: 禁止复制

上面是“wordpress如何防止文章复制(附代码)”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_3331.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > wordpress
本文共计677个字,预计阅读时长5分钟
生活小工具,收录了80多款小工具
上一篇: 推荐一款简单高效漂亮的多平台笔记应用——Zoho Notebook
下一篇: 推荐2款充满科技感的艺术字体——小新黑体、小新潮酷体
x 打工人ai神器