{"id":3756,"date":"2019-12-06T15:04:35","date_gmt":"2019-12-06T07:04:35","guid":{"rendered":"https:\/\/blog.naibabiji.com\/?p=3756"},"modified":"2019-12-06T15:04:35","modified_gmt":"2019-12-06T07:04:35","slug":"disable-plugin-deactivation","status":"publish","type":"post","link":"https:\/\/blog.naibabiji.com\/skill\/disable-plugin-deactivation.html","title":{"rendered":"WordPress\u5220\u9664\u63d2\u4ef6\u7981\u7528\u6309\u94ae\u7684\u4ee3\u7801\u65b9\u6cd5"},"content":{"rendered":"<p>\u5982\u679c\u4f60\u662f\u4f7f\u7528\u7684WordPress\u5e2e\u522b\u4eba\u5efa\u7f51\u7ad9\uff0c\u90a3\u4e48\u628a\u7f51\u7ad9\u642d\u5efa\u597d\u4e86\u7ed9\u5ba2\u6237\u7684\u65f6\u5019\uff0c\u4e07\u4e00\u5ba2\u6237\u624b\u6ed1\u628a\u7f51\u7ad9\u5fc5\u8981\u63d2\u4ef6\u7ed9\u7981\u7528\u4e86\uff0c\u52bf\u5fc5\u4f1a\u7ed9\u4f60\u5e26\u6765\u4e00\u4e9b\u4e0d\u5fc5\u8981\u7684\u9ebb\u70e6\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u7981\u6b62\u67d0\u4e9b\u63d2\u4ef6\u7684\u7981\u7528\u529f\u80fd\u3002<\/p>\n<p>\u4e0b\u9762\u5c31\u4ecb\u7ecd\u4e0b\u5982\u4f55\u4f7f\u7528\u4ee3\u7801\u7981\u6b62\u7279\u5b9a\u63d2\u4ef6\u7684\u7981\u7528\u529f\u80fd\u3002<\/p>\n<h2>\u5220\u9664\u7279\u5b9a\u63d2\u4ef6\u7684\u7981\u7528\u529f\u80fd<\/h2>\n<p>\u548c\u4e4b\u524d\u201c<a href=\"https:\/\/blog.naibabiji.com\/skill\/wordpress-jin-zhi-cha-jian-geng-xin-ti-xing.html\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress\u7981\u7528\u7279\u5b9a\u63d2\u4ef6\u7684\u66f4\u65b0\u63d0\u793a<\/a>\u201d\u7684\u65b9\u6cd5\u4e00\u6837\uff0c\u628a\u4e0b\u9762\u7684\u4ee3\u7801\u6dfb\u52a0\u5230\u7f51\u7ad9\u4e3b\u9898\u6587\u4ef6\u7684\u51fd\u6570\u4ee3\u7801\u91cc\u9762\uff0c\u4e0d\u4f1a\u6dfb\u52a0\u7684\u670b\u53cb\u5efa\u8bae\u4f7f\u7528\uff1a<a href=\"https:\/\/blog.naibabiji.com\/tutorial\/wordpress-code-snippets.html\">\u5b89\u5168\u6dfb\u52a0\u4ee3\u7801\u5230functions.php\u6587\u4ef6\u7684\u65b9\u6cd5\uff1aCode Snippets<\/a><\/p>\n<pre>\/\/\u5220\u9664\u7279\u5b9a\u63d2\u4ef6\u7684\u7981\u7528\u529f\u80fd\r\nadd_filter( 'plugin_action_links', 'wpkj_disable_plugin_deactivation', 10, 4 );\r\n\r\nfunction wpkj_disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) {\r\n \r\n    if ( array_key_exists( 'deactivate', $actions ) &amp;&amp; in_array( $plugin_file, array(\r\n        'wpforms\/wpforms.php',\r\n        'woocommerce\/woocommerce.php'\r\n    )))\r\n        unset( $actions['deactivate'] );\r\n    return $actions;\r\n}<\/pre>\n<p>\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c<\/p>\n<pre>'wpforms\/wpforms.php',\r\n'woocommerce\/woocommerce.php'<\/pre>\n<p>\u8fd9\u4e24\u884c\u662f\u8981\u5220\u9664\u7981\u7528\u4ee3\u7801\u7684\u63d2\u4ef6\u4f4d\u7f6e\uff0c\u4f60\u53ef\u4ee5\u5728\u670d\u52a1\u5668\u63d2\u4ef6\u76ee\u5f55\uff08wp-content\/plugins\uff09\u91cc\u9762\u627e\u5230\u6bcf\u4e00\u4e2a\u63d2\u4ef6\u7684\u6587\u4ef6\u5939\uff0c\u8fdb\u5165\u63d2\u4ef6\u6587\u4ef6\u5939\u540e\u901a\u5e38\u548c\u63d2\u4ef6\u540c\u540d\u7684\u6587\u4ef6\u5c31\u662f\u3002<\/p>\n<p>\u6dfb\u52a0\u540e\u7f51\u7ad9\u63d2\u4ef6\u5c31\u6ca1\u6709\u7981\u7528\u6309\u94ae\u4e86\uff0c\u4e0d\u7528\u62c5\u5fc3\u5ba2\u6237\u4e71\u641e\u7ed9\u81ea\u5df1\u589e\u52a0\u5de5\u4f5c\u91cf\u3002<\/p>\n<p>\u65b9\u6cd5\u6765\u6e90\uff1a<a href=\"https:\/\/www.wpdaxue.com\/prevent-customers-from-disabling-wordpress-plugins.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">WP\u5927\u5b66<\/a><\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;3756&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;0&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;0&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;4&quot;,&quot;greet&quot;:&quot;\u7ed9\u672c\u6587\u6253\u5206 post&quot;,&quot;legend&quot;:&quot;0\\\/5 - (0 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;WordPress\u5220\u9664\u63d2\u4ef6\u7981\u7528\u6309\u94ae\u7684\u4ee3\u7801\u65b9\u6cd5&quot;,&quot;width&quot;:&quot;0&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 0px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            <span class=\"kksr-muted\">\u7ed9\u672c\u6587\u6253\u5206 post<\/span>\n    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u4f60\u662f\u4f7f\u7528\u7684WordPress\u5e2e\u522b\u4eba\u5efa\u7f51\u7ad9\uff0c\u90a3\u4e48\u628a\u7f51\u7ad9\u642d\u5efa\u597d\u4e86\u7ed9\u5ba2\u6237\u7684\u65f6\u5019\uff0c\u4e07\u4e00\u5ba2\u6237\u624b\u6ed1\u628a\u7f51\u7ad9\u5fc5\u8981\u63d2\u4ef6\u7ed9\u7981\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3757,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"WordPress\u5220\u9664\u63d2\u4ef6\u7981\u7528\u6309\u94ae\u7684\u4ee3\u7801\u65b9\u6cd5 - \u5976\u7238\u5efa\u7ad9\u7b14\u8bb0","description":"\u5982\u679c\u4f60\u662f\u4f7f\u7528\u7684WordPress\u5e2e\u522b\u4eba\u5efa\u7f51\u7ad9\uff0c\u90a3\u4e48\u628a\u7f51\u7ad9\u642d\u5efa\u597d\u4e86\u7ed9\u5ba2\u6237\u7684\u65f6\u5019\uff0c\u4e07\u4e00\u5ba2\u6237\u624b\u6ed1\u628a\u7f51\u7ad9\u5fc5\u8981\u63d2\u4ef6\u7ed9\u7981\u7528\u4e86\uff0c\u52bf\u5fc5\u4f1a\u7ed9\u4f60\u5e26\u6765\u4e00\u4e9b\u4e0d\u5fc5\u8981\u7684\u9ebb\u70e6\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u7981\u6b62\u67d0\u4e9b\u63d2\u4ef6\u7684\u7981\u7528\u529f\u80fd\u3002 \u4e0b\u9762\u5c31\u4ecb\u7ecd\u4e0b\u5982\u4f55\u4f7f\u7528\u4ee3\u7801\u7981\u6b62\u7279\u5b9a\u63d2\u4ef6\u7684\u7981\u7528\u529f\u80fd\u3002 \u5220\u9664\u7279\u5b9a\u63d2\u4ef6\u7684\u7981\u7528\u529f\u80fd \u548c\u4e4b\u524d\u201c WordPress\u7981\u7528\u7279\u5b9a\u63d2\u4ef6\u7684\u66f4\u65b0\u63d0\u793a \u201d\u7684\u65b9\u6cd5\u4e00"},"footnotes":""},"categories":[142],"tags":[],"class_list":["post-3756","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/3756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/comments?post=3756"}],"version-history":[{"count":0,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/3756\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media\/3757"}],"wp:attachment":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media?parent=3756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/categories?post=3756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/tags?post=3756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}