{"id":1026,"date":"2025-06-10T02:01:56","date_gmt":"2025-06-09T18:01:56","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/wpcms\/wpdt\/1026.html"},"modified":"2025-06-10T02:01:56","modified_gmt":"2025-06-09T18:01:56","slug":"12%e4%b8%aa%e7%ae%80%e5%8d%95%e6%8a%80%e5%b7%a7%ef%bc%8c%e8%bd%bb%e6%9d%be%e6%8f%90%e5%8d%87wordpress%e7%bd%91%e7%ab%99%e5%81%a5%e5%ba%b7%e6%a3%80%e6%9f%a5%e8%af%84%e5%88%86","status":"publish","type":"post","link":"https:\/\/www.zhaozhao123.cn\/wpcms\/post\/1026.html","title":{"rendered":"12\u4e2a\u7b80\u5355\u6280\u5de7\uff0c\u8f7b\u677e\u63d0\u5347WordPress\u7f51\u7ad9\u5065\u5eb7\u68c0\u67e5\u8bc4\u5206"},"content":{"rendered":"<div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<h2 class=\"wp-block-heading my-0\">&#20889; Bug&#24037;&#31243;&#24072;&#65306;<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#25552;&#39640;WordPress&#32593;&#31449;&#30340;&#20581;&#24247;&#26816;&#26597;&#35780;&#20998;&#26159;&#20445;&#25345;&#32593;&#31449;&#31283;&#23450;&#21644;&#29992;&#25143;&#20307;&#39564;&#30340;&#20851;&#38190;&#12290;&#20197;&#19979;&#26159;12&#20010;&#23454;&#29992;&#30340;&#25216;&#24039;&#65292;&#21487;&#20197;&#24110;&#21161;&#24744;&#25552;&#21319;&#32593;&#31449;&#30340;&#20581;&#24247;&#26816;&#26597;&#35780;&#20998;&#65306;<\/p>\n<h3>1. &#23450;&#26399;&#22791;&#20221;&#25968;&#25454;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: WordPress&#30340;&#25968;&#25454;&#22791;&#20221;&#33267;&#20851;&#37325;&#35201;&#65292;&#21487;&#20197;&#38450;&#27490;&#25968;&#25454;&#20002;&#22833;&#25110;&#25439;&#22351;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#33258;&#21160;&#22791;&#20221;&#25991;&#20214;&#22841;\n$backup_dir = wp_upload_dir()['basedir'] . '\/site-backups\/';\nif (!file_exists($backup_dir)) {\n    mkdir($backup_dir, 0755, true);\n}\n\n\/\/ &#22791;&#20221;&#25991;&#20214;\nwp_muplugin_backup();\n\nfunction wp_muplugin_backup() {\n    $args = array(\n        'network' =&gt; false,\n        'date_format' =&gt; '%Y%m%d%H%M%S',\n        'archive_description' =&gt; 'WordPress Site Backup',\n        'gzip' =&gt; true,\n        'delete_after' =&gt; true,\n        'exclude_plugins' =&gt; '',\n        'exclude_files' =&gt; '',\n        'exclude_dirs' =&gt; '',\n        'zip_exclude' =&gt; '',\n    );\n\n    \/\/ &#36827;&#34892;&#25968;&#25454;&#24211;&#22791;&#20221;\n    if ( !empty( $_SERVER['WP_HOME'] ) &amp;&amp; is_multisite() ) {\n        $dir = new WP_Site_Backup( $_SERVER['WP_HOME'], $_SERVER['WP_SITEURL'], $args );\n        $dir-&gt;start();\n    } else {\n        $dir = new WP_Site_Backup( home_url(), site_url(), $args );\n        $dir-&gt;start();\n    }\n}<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;WordPress&#23433;&#35013;&#30446;&#24405;&#19979;&#21019;&#24314;&#19968;&#20010;&#21517;&#20026;<code>site-backups<\/code>&#30340;&#26032;&#25991;&#20214;&#22841;&#29992;&#20110;&#23384;&#20648;&#22791;&#20221;&#25991;&#20214;&#12290;&#28982;&#21518;&#65292;&#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#25191;&#34892;&#33258;&#21160;&#22791;&#20221;&#25805;&#20316;&#12290;<\/p>\n<h3>2. &#20351;&#29992;&#25554;&#20214;&#31649;&#29702;&#24037;&#20855;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#25554;&#20214;&#31649;&#29702;&#24037;&#20855;&#22914;WordFence&#12289;Akeeba Backup&#31561;&#65292;&#21487;&#20197;&#26377;&#25928;&#22320;&#31649;&#29702;&#21644;&#22791;&#20221;&#24744;&#30340;WordPress&#25554;&#20214;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#26816;&#26597;&#26159;&#21542;&#26377;&#25554;&#20214;&#26356;&#26032;\nif ( function_exists('update_site_transient') ) {\n    update_site_transient( 'akismet_recent_comments', null );\n} else {\n    $akismet = akismet_create_instance();\n    $akismet-&gt;check_for_updates();\n}\n\n\/\/ &#28155;&#21152;&#25554;&#20214;&#26356;&#26032;&#36890;&#30693;\nadd_action( 'admin_notices', 'show_plugin_update_notification' );\n\nfunction show_plugin_update_notification() {\n    if ( class_exists( 'Akismet' ) &amp;&amp; Akismet::get_version() != Akismet::VERSION ) {\n        echo '&lt;div class=\"updated\"&gt;&lt;p&gt;&lt;strong&gt;' . __( 'You have a newer version of Akismet available.', 'textdomain' ) . '&lt;\/strong&gt;&lt;\/p&gt;&lt;\/div&gt;';\n    }\n}\n\n\/\/ &#33258;&#21160;&#20462;&#22797;&#25554;&#20214;&#38169;&#35823;\nregister_activation_hook(__FILE__, 'akismet_install');\nregister_deactivation_hook(__FILE__, 'akismet_uninstall');\n\nfunction akismet_install() {\n    global $wpdb;\n    $table_name = $wpdb-&gt;prefix . \"akismet\";\n    $wpdb-&gt;query(\"CREATE TABLE IF NOT EXISTS `$table_name` (\n      `id` int(11) NOT NULL AUTO_INCREMENT,\n      `key` varchar(64) NOT NULL,\n      `secret` varchar(32) NOT NULL,\n      PRIMARY KEY (`id`)\n    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\");\n}<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#30830;&#20445;&#24744;&#30340;&#25554;&#20214;&#22987;&#32456;&#26159;&#26368;&#26032;&#30340;&#12290;&#27492;&#22806;&#65292;&#24744;&#36824;&#21487;&#20197;&#22312;&#21518;&#21488;&#36890;&#36807;WordFence&#31561;&#25554;&#20214;&#26469;&#31649;&#29702;&#25554;&#20214;&#24182;&#26597;&#30475;&#26356;&#26032;&#36890;&#30693;&#12290;<\/p>\n<h3>3. &#21512;&#29702;&#20351;&#29992;&#32531;&#23384;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#32531;&#23384;&#21487;&#20197;&#26174;&#33879;&#20943;&#23569;&#26381;&#21153;&#22120;&#36127;&#36733;&#65292;&#21152;&#24555;&#39029;&#38754;&#21152;&#36733;&#36895;&#24230;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#35774;&#32622;&#21551;&#29992;W3 Total Cache&#25554;&#20214;\nadd_filter( 'w3tc_cacheable_headers', '__return_true' );<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#25214;&#21040;&#24744;&#30340;WordPress&#23433;&#35013;&#30446;&#24405;&#19979;&#30340;<code>wp-content\/plugins\/w3-total-cache\/<\/code>&#25991;&#20214;&#22841;&#65292;&#25214;&#21040;&#23545;&#24212;&#30340;&#35774;&#32622;&#25991;&#20214;&#65288;&#36890;&#24120;&#26159;<code>settings.php<\/code>&#65289;&#65292;&#24182;&#22312;&#20854;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#21551;&#29992;W3 Total Cache&#25554;&#20214;&#12290;<\/p>\n<h3>4. &#30830;&#20445;&#23433;&#20840;&#35774;&#32622;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#39640;&#32423;&#30340;&#23433;&#20840;&#25514;&#26045;&#23545;&#20110;&#20445;&#25252;&#24744;&#30340;&#32593;&#31449;&#20813;&#21463;&#25915;&#20987;&#38750;&#24120;&#37325;&#35201;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#21551;&#29992;HTTPS\ndefine('FORCE_SSL_ADMIN', true);\n\n\/\/ &#31105;&#27490;&#36828;&#31243;&#30331;&#24405;\ndefine('DISALLOW_FILE_EDIT', true);\n\n\/\/ &#20840;&#23616;&#31105;&#29992;XML-RPC&#25509;&#21475;\nremove_action('rest_api_init', 'rest_api_register_routes');<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#30830;&#20445;&#24744;&#30340;&#32593;&#31449;&#21482;&#25509;&#21463;HTTPS&#36830;&#25509;&#65292;&#24182;&#31105;&#29992;&#36828;&#31243;&#30331;&#24405;&#21644;XML-RPC&#25509;&#21475;&#12290;<\/p>\n<h3>5. &#30417;&#25511;&#32593;&#31449;&#24615;&#33021;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#20351;&#29992;Google Analytics&#25110;&#20854;&#20182;&#30417;&#25511;&#24037;&#20855;&#26469;&#36319;&#36394;&#32593;&#31449;&#24615;&#33021;&#25351;&#26631;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#33719;&#21462;&#32593;&#31449;&#27969;&#37327;\nfunction get_traffic() {\n    return wp_safe_remote_get('<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS9hbmFseXRpY3Mv\" rel=\"noopener noreferrer nofollow\">https:\/\/www.google.com\/analytics\/<\/a>').'&lt;br&gt;';\n}<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#33719;&#21462;&#32593;&#31449;&#30340;&#27969;&#37327;&#32479;&#35745;&#20449;&#24687;&#12290;<\/p>\n<h3>6. &#32500;&#25252;&#33391;&#22909;&#30340;&#20027;&#26426;&#26381;&#21153;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#36873;&#25321;&#21512;&#36866;&#30340;&#20027;&#26426;&#26381;&#21153;&#23545;&#32593;&#31449;&#30340;&#36816;&#34892;&#33267;&#20851;&#37325;&#35201;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#35774;&#32622;&#20027;&#26426;&#26381;&#21153;&#21830;\ndefine('WP_HOST', 'example.com');<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#35774;&#32622;&#20027;&#26426;&#26381;&#21153;&#21830;&#20026;&ldquo;example.com&rdquo;&#12290;<\/p>\n<h3>7. &#23450;&#26399;&#28165;&#29702;&#26080;&#29992;&#25991;&#20214;&#21644;&#25968;&#25454;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#28165;&#29702;&#19981;&#24517;&#35201;&#30340;&#25991;&#20214;&#21644;&#25968;&#25454;&#21487;&#20197;&#37322;&#25918;&#23453;&#36149;&#30340;&#20869;&#23384;&#36164;&#28304;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#28165;&#29702;&#26087;&#26085;&#24535;&#25991;&#20214;\nfunction clean_old_logs() {\n    $now = time();\n    $days_to_keep = 30; \/\/ &#20445;&#30041;&#26368;&#36817;30&#22825;&#30340;&#26085;&#24535;\n    $logs_directory = ABSPATH . 'logs\/';\n\n    foreach(glob(\"$logs_directory*\") as $logfile) {\n        $mtime = filemtime($logfile);\n        if ($now - $mtime &gt; $days_to_keep * 24 * 60 * 60) {\n            unlink($logfile);\n        }\n    }\n}<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#23450;&#26399;&#28165;&#29702;&#26087;&#26085;&#24535;&#25991;&#20214;&#12290;<\/p>\n<h3>8. &#20351;&#29992;&#39640;&#36136;&#37327;&#30340;&#20027;&#39064;&#21644;&#25554;&#20214;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#36141;&#20080;&#39640;&#36136;&#37327;&#30340;&#20027;&#39064;&#21644;&#25554;&#20214;&#21487;&#20197;&#25552;&#20379;&#26356;&#22909;&#30340;&#21151;&#33021;&#21644;&#31283;&#23450;&#24615;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#28155;&#21152;&#33258;&#23450;&#20041;&#26679;&#24335;&#34920;\nfunction my_custom_stylesheets() {\n    wp_enqueue_style('my-custom-styles', get_stylesheet_uri());\n}\nadd_action('wp_enqueue_scripts', 'my_custom_stylesheets');<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#22312;&#39029;&#38754;&#19978;&#28155;&#21152;&#33258;&#23450;&#20041;CSS&#26679;&#24335;&#34920;&#12290;<\/p>\n<h3>9. &#37197;&#32622;&#36866;&#24403;&#30340;HTTP&#22836;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: HTTP&#22836;&#20013;&#30340;&#26576;&#20123;&#35774;&#32622;&#21487;&#20197;&#24433;&#21709;&#25628;&#32034;&#24341;&#25806;&#25235;&#21462;&#21644;&#29992;&#25143;&#27983;&#35272;&#20307;&#39564;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#35774;&#32622;&#21709;&#24212;&#26102;&#38388;&#19978;&#38480;\nheader('Cache-Control: max-age=3600');<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#35774;&#32622;&#21709;&#24212;&#26102;&#38388;&#19978;&#38480;&#12290;<\/p>\n<h3>10. &#20248;&#21270;&#22270;&#29255;&#22823;&#23567;&#21644;&#26684;&#24335;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#36866;&#24403;&#21387;&#32553;&#21644;&#35843;&#25972;&#22270;&#29255;&#23610;&#23544;&#21487;&#20197;&#25552;&#39640;&#32593;&#31449;&#21152;&#36733;&#36895;&#24230;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#21387;&#32553;&#22270;&#29255;\nfunction compress_image($src, $dest) {\n    $image = imagecreatefromjpeg($src);\n    list($width, $height) = getimagesize($src);\n    $new_width = 100;\n    $new_height = round(($height \/ $width) * $new_width);\n    $thumb_img = imagecreatetruecolor($new_width, $new_height);\n    imagecopyresampled($thumb_img, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);\n    imagejpeg($thumb_img, $dest);\n    imagedestroy($image);\n    imagedestroy($thumb_img);\n}\n\n\/\/ &#24212;&#29992;&#20989;&#25968;\ncompress_image('\/path\/to\/image.jpg', '\/path\/to\/thumb.jpg');<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#21387;&#32553;&#22270;&#29255;&#24182;&#20445;&#23384;&#20026;&#32553;&#30053;&#22270;&#12290;<\/p>\n<h3>11. &#23454;&#26045;SEO&#26368;&#20339;&#23454;&#36341;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#26681;&#25454;&#25628;&#32034;&#24341;&#25806;&#30340;&#26368;&#20339;&#23454;&#36341;&#26469;&#20248;&#21270;&#32593;&#31449;&#30340;&#20869;&#23481;&#21644;&#32467;&#26500;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-php\">\/\/ &#28155;&#21152;&#20803;&#26631;&#31614;\nfunction add_meta_tags() {\n    ?&gt;\n    &lt;meta name=\"description\" content=\"&lt;?php echo esc_attr(get_the_excerpt()); ?&gt;\"&gt;\n    &lt;meta property=\"og:title\" content=\"&lt;?php the_title(); ?&gt;\" \/&gt;\n    &lt;meta property=\"og:description\" content=\"&lt;?php the_content(); ?&gt;\" \/&gt;\n    &lt;?php\n}\nadd_action('wp_head', 'add_meta_tags');<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#20027;&#39064;&#30340;functions.php&#25991;&#20214;&#20013;&#28155;&#21152;&#19978;&#36848;&#20195;&#30721;&#20197;&#28155;&#21152;&#20803;&#26631;&#31614;&#12290;<\/p>\n<h3>12. &#20445;&#25345;&#31995;&#32479;&#26356;&#26032;<\/h3>\n<p><strong>&#30693;&#35782;&#28857;<\/strong>: &#23433;&#20840;&#24615;&#26356;&#26032;&#21644;&#24615;&#33021;&#25913;&#36827;&#21487;&#20197;&#36890;&#36807;&#21450;&#26102;&#26356;&#26032;&#25805;&#20316;&#31995;&#32479;&#21644;PHP&#29256;&#26412;&#26469;&#23454;&#29616;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;<\/strong>:<\/p>\n<pre><code class=\"language-bash\"># &#26356;&#26032;WordPress&#26680;&#24515;\nwp core update --all-tables\n\n# &#26356;&#26032;&#25554;&#20214;&#21644;&#20027;&#39064;\nwp plugin update all\nwp theme update all<\/code><\/pre>\n<p><strong>&#20351;&#29992;&#27493;&#39588;<\/strong>: &#22312;&#24744;&#30340;&#21629;&#20196;&#34892;&#30028;&#38754;&#20013;&#36816;&#34892;&#19978;&#36848;&#20195;&#30721;&#20197;&#26356;&#26032;WordPress&#30340;&#26680;&#24515;&#20197;&#21450;&#25152;&#26377;&#25554;&#20214;&#21644;&#20027;&#39064;&#12290;<\/p>\n<p>&#36890;&#36807;&#36981;&#24490;&#36825;&#20123;&#25216;&#24039;&#65292;&#24744;&#21487;&#20197;&#26174;&#33879;&#25552;&#21319;WordPress&#32593;&#31449;&#30340;&#20581;&#24247;&#26816;&#26597;&#35780;&#20998;&#65292;&#20174;&#32780;&#25552;&#39640;&#20854;&#25972;&#20307;&#24615;&#33021;&#21644;&#23433;&#20840;&#24615;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div><div class=\"wp-block-columns p-0 border is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-columns px-4 py-3 border-bottom has-background is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\" style=\"background:linear-gradient(243deg,rgb(238,238,238) 0%,rgba(58,166,242,0.15) 100%)\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\r\n<h2 class=\"wp-block-heading my-0\">&#40657;&#26495;IDE&#25945;&#20070;&#21280;&#65306;<\/h2>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n\r\n\r\n<div class=\"wp-block-columns px-xl-5 px-4 py-xl-4 py-3 is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\r\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\r\n<p>&#20026;&#20102;&#24110;&#21161;&#24744;&#25552;&#39640;WordPress&#32593;&#31449;&#30340;&#20581;&#24247;&#26816;&#26597;&#35780;&#20998;&#65292;&#20197;&#19979;&#26159;&#19968;&#20123;&#31616;&#21333;&#30340;&#25216;&#24039;&#21644;&#24314;&#35758;&#65306;<\/p>\n<h3>1. &#23450;&#26399;&#22791;&#20221;&#25968;&#25454;<\/h3>\n<ul>\n<li><strong>&#22909;&#22788;<\/strong>&#65306;&#21363;&#20351;&#21457;&#29983;&#25925;&#38556;&#25110;&#40657;&#23458;&#25915;&#20987;&#65292;&#20063;&#33021;&#30830;&#20445;&#24744;&#30340;&#32593;&#31449;&#25968;&#25454;&#19981;&#20250;&#20002;&#22833;&#12290;<\/li>\n<li>\n<p><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;<\/p>\n<pre><code class=\"language-php\">\/\/ &#20351;&#29992;WordPress&#20869;&#32622;&#30340;&#22791;&#20221;&#21151;&#33021;\nwp_backup_install();\n\n\/\/ &#25110;&#32773;&#20351;&#29992;&#31532;&#19977;&#26041;&#25554;&#20214;&#22914;WooCommerce Backup&#65288;<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cHM6Ly93b3JkcHJlc3Mub3JnL3BsdWdpbnMvd29vY29vbWVyY2UtYmFja3VwLw==\" rel=\"noopener noreferrer nofollow\">https:\/\/wordpress.org\/plugins\/woocoomerce-backup\/<\/a>&#65289;\nwoocommerce_rest_api()-&gt;backup(); <\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>2. &#26356;&#26032;&#33267;&#26368;&#26032;&#29256;&#26412;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#26032;&#29256;&#26412;&#36890;&#24120;&#21253;&#21547;&#20462;&#22797;&#24050;&#30693;&#38382;&#39064;&#12289;&#24615;&#33021;&#20248;&#21270;&#21644;&#23433;&#20840;&#26356;&#26032;&#12290;<\/li>\n<li>\n<p><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;<\/p>\n<pre><code class=\"language-bash\"># &#22312;&#32456;&#31471;&#36816;&#34892;WordPress&#23433;&#35013;&#30446;&#24405;&#19979;&#30340;wp-cli&#33050;&#26412;\ncd wp-content\/plugins\/wp-cli &amp;&amp; php wp-cli.php update-core\n\n# &#25110;&#32773;&#20351;&#29992;WordPress&#23448;&#26041;&#25552;&#20379;&#30340;&#33258;&#21160;&#26356;&#26032;&#24037;&#20855;\nsudo apt-get update &amp;&amp; sudo apt-get install -y software-properties-common &amp;&amp; sudo add-apt-repository universe &amp;&amp; sudo apt-get install -y software-properties-common &amp;&amp; sudo apt-get update &amp;&amp; sudo apt-get install --yes wordpress-cli<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>3. &#23433;&#35013;&#24182;&#21551;&#29992;&#23433;&#20840;&#25554;&#20214;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#35768;&#22810;&#25554;&#20214;&#21487;&#20197;&#25552;&#20379;&#39069;&#22806;&#30340;&#23433;&#20840;&#21151;&#33021;&#65292;&#20363;&#22914;&#38450;&#27490;SQL&#27880;&#20837;&#12289;&#36328;&#31449;&#33050;&#26412;&#25915;&#20987;&#31561;&#12290;<\/li>\n<li>\n<p><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;<\/p>\n<pre><code class=\"language-bash\"># &#26816;&#26597;&#26159;&#21542;&#24050;&#23433;&#35013;&#24517;&#35201;&#30340;&#25554;&#20214;\nwp plugin list\n\n# &#22914;&#26524;&#27809;&#26377;&#65292;&#35831;&#36890;&#36807;WordPress&#25554;&#20214;&#21830;&#24215;&#23433;&#35013;&#25554;&#20214;\nwp plugin install <a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cHM6Ly93b3JkcHJlc3Mub3JnL3BsdWdpbnMvc2VjdXJpdHktY2hlY2tsaXN0Lw==\" rel=\"noopener noreferrer nofollow\">https:\/\/wordpress.org\/plugins\/security-checklist\/<\/a><\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>4. &#31105;&#29992;&#19981;&#24517;&#35201;&#30340;&#21151;&#33021;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#26576;&#20123;&#21151;&#33021;&#21487;&#33021;&#20250;&#22686;&#21152;&#34987;&#20837;&#20405;&#30340;&#39118;&#38505;&#65292;&#29305;&#21035;&#26159;&#37027;&#20123;&#23481;&#26131;&#21463;&#21040;SQL&#27880;&#20837;&#25915;&#20987;&#30340;&#21151;&#33021;&#12290;<\/li>\n<li>\n<p><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;<\/p>\n<pre><code class=\"language-php\">\/\/ &#22312;&#20027;&#39064;&#25110;&#25554;&#20214;&#25991;&#20214;&#20013;&#31105;&#29992;&#21487;&#33021;&#24341;&#36215;&#38382;&#39064;&#30340;&#21151;&#33021;\nfunction disable_potentially_vulnerable_features() {\nif ( ! is_admin() ) {\n  $functions_to_disable = [\n    'woocommerce_checkout_cart_totals',\n    'woocommerce_checkout_order_total',\n    'woocommerce_product_add_to_cart_button',\n    'woocommerce_checkout_shipping_address',\n    'woocommerce_checkout_payment_method_selector',\n  ];\n\n  foreach ( $functions_to_disable as $function ) {\n    remove_action( 'admin_menu', array( $function, 'register' ), 0 );\n  }\n}\n}\n\nadd_action( 'init', 'disable_potentially_vulnerable_features' );<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>5. &#35774;&#32622;&#20005;&#26684;&#30340;&#36523;&#20221;&#39564;&#35777;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#38480;&#21046;&#35775;&#38382;&#26435;&#38480;&#21487;&#20197;&#38477;&#20302;&#34987;&#25915;&#20987;&#30340;&#39118;&#38505;&#12290;<\/li>\n<li><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;\n<pre><code class=\"language-php\">\/\/ &#22312;&#29992;&#25143;&#31649;&#29702;&#30028;&#38754;&#35774;&#32622;&#20005;&#26684;&#30340;&#23494;&#30721;&#22797;&#26434;&#24615;&#35268;&#21017;\nadd_filter( 'authenticate_user', 'my_custom_auth_function' );\nfunction my_custom_auth_function( $credentials ) {\nreturn wp_check_password( $_POST['password'], $credentials['user_login'] );\n}<\/code><\/pre><\/li>\n<\/ul>\n<h3>6. &#38450;&#27490;CSRF&#25915;&#20987;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#36991;&#20813;&#24694;&#24847;&#35831;&#27714;&#32469;&#36807;&#36523;&#20221;&#39564;&#35777;&#12290;<\/li>\n<li><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;\n<pre><code class=\"language-php\">\/\/ &#22312;&#30331;&#24405;&#39029;&#38754;&#28155;&#21152;CSRF&#20445;&#25252;\nwp_enqueue_script('csrf-script');<\/code><\/pre><\/li>\n<\/ul>\n<h3>7. &#31105;&#29992;&#19981;&#24517;&#35201;&#30340;&#21151;&#33021;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#26576;&#20123;&#21151;&#33021;&#21487;&#33021;&#20250;&#23548;&#33268;&#23433;&#20840;&#28431;&#27934;&#12290;<\/li>\n<li><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;\n<pre><code class=\"language-javascript\">\/\/ &#22312;PHP&#25193;&#23637;&#20013;&#31105;&#29992;&#19981;&#24517;&#35201;&#30340;&#20989;&#25968;\ndefine('WP_DISABLE_FUNCTION_1', true);\ndefine('WP_DISABLE_FUNCTION_2', true);<\/code><\/pre><\/li>\n<\/ul>\n<h3>8. &#20351;&#29992;HTTPS&#21327;&#35758;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;HTTPS&#26377;&#21161;&#20110;&#38450;&#27490;&#20449;&#24687;&#27844;&#38706;&#21644;&#24694;&#24847;&#25915;&#20987;&#12290;<\/li>\n<li><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;\n<pre><code class=\"language-html\">&lt;head&gt;\n&lt;title&gt;Secure Site Title&lt;\/title&gt;\n&lt;link rel=\"stylesheet\" href=\"https:<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cDovL3N0YWNrcGF0aC5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC80LjUuMi9jc3MvYm9vdHN0cmFwLm1pbi5jc3M=\" rel=\"noopener noreferrer nofollow\">\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.2\/css\/bootstrap.min.css<\/a>\"&gt;\n&lt;script src=\"https:<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cDovL2NvZGUuanF1ZXJ5LmNvbS9qcXVlcnktMy41LjEuc2xpbS5taW4uanM=\" rel=\"noopener noreferrer nofollow\">\/\/code.jquery.com\/jquery-3.5.1.slim.min.js<\/a>\"&gt;&lt;\/script&gt;\n&lt;script src=\"https:<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cDovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtLw==\" rel=\"noopener noreferrer nofollow\">\/\/cdn.jsdelivr.net\/npm\/<\/a>@popperjs\/core@2.9.3\/dist\/umd\/popper.min.js\"&gt;&lt;\/script&gt;\n&lt;script src=\"https:<a href=\"https:\/\/www.zhaozhao123.cn\/skin\/go?url=aHR0cDovL3N0YWNrcGF0aC5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC80LjUuMi9qcy9ib290c3RyYXAubWluLmpz\" rel=\"noopener noreferrer nofollow\">\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.2\/js\/bootstrap.min.js<\/a>\"&gt;&lt;\/script&gt;\n&lt;\/head&gt;<\/code><\/pre><\/li>\n<\/ul>\n<h3>9. &#30417;&#25511;&#26085;&#24535;&#35760;&#24405;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#21450;&#26102;&#21457;&#29616;&#28508;&#22312;&#30340;&#23433;&#20840;&#23041;&#32961;&#38750;&#24120;&#37325;&#35201;&#12290;<\/li>\n<li>\n<p><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;<\/p>\n<pre><code class=\"language-php\">\/\/ &#22312;WordPress&#20013;&#37197;&#32622;&#26085;&#24535;&#32423;&#21035;&#20026;DEBUG\nadd_option( 'log_level', 'info' );\n\n\/\/ &#20351;&#29992;WordPress&#20869;&#32622;&#30340;&#26085;&#24535;&#27169;&#22359;&#30417;&#25511;&#29305;&#23450;&#26085;&#24535;&#31867;&#22411;\nadd_action( 'in_admin_footer', 'log_check' );\nfunction log_check() {\nif ( isset( $_GET['action'] ) &amp;&amp; $_GET['action'] == 'log_check' ) {\n  echo '&lt;pre&gt;';\n  print_r( get_option( 'log_level' ) );\n  echo '&lt;\/pre&gt;';\n}\n}<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>10. &#23450;&#26399;&#25195;&#25551;&#30149;&#27602;&#24211;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#23450;&#26399;&#25195;&#25551;&#21487;&#20197;&#24110;&#21161;&#26816;&#27979;&#21040;&#26032;&#30340;&#23433;&#20840;&#23041;&#32961;&#12290;<\/li>\n<li><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;\n<pre><code class=\"language-bash\"># &#25195;&#25551;WordPress&#26680;&#24515;\nwp scan core\n# &#25195;&#25551;&#22806;&#37096;&#25554;&#20214;\nwp scan plugins\n# &#25195;&#25551;&#22806;&#37096;&#20027;&#39064;\nwp scan themes<\/code><\/pre><\/li>\n<\/ul>\n<h3>11. &#23450;&#26399;&#26356;&#26032;WordPress&#25554;&#20214;&#21644;&#20027;&#39064;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#26032;&#30340;&#26356;&#26032;&#36890;&#24120;&#21253;&#21547;&#20102;&#20462;&#22797;&#30340;&#24050;&#30693;&#38169;&#35823;&#21644;&#23433;&#20840;&#24615;&#25913;&#36827;&#12290;<\/li>\n<li><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;\n<pre><code class=\"language-bash\"># &#25351;&#23450;&#35201;&#26356;&#26032;&#30340;&#25554;&#20214;&#21644;&#20027;&#39064;\nwp plugin update [plugin_name]\nwp theme update [theme_name]<\/code><\/pre><\/li>\n<\/ul>\n<h3>12. &#20851;&#38381;&#19981;&#24517;&#35201;&#30340;&#21518;&#21488;&#21151;&#33021;<\/h3>\n<ul>\n<li><strong>&#21407;&#22240;<\/strong>&#65306;&#36807;&#22810;&#30340;&#21518;&#21488;&#21151;&#33021;&#21487;&#33021;&#23548;&#33268;&#23433;&#20840;&#28431;&#27934;&#12290;<\/li>\n<li><strong>&#25805;&#20316;&#27493;&#39588;<\/strong>&#65306;\n<pre><code class=\"language-php\">\/\/ &#22312;&#21518;&#21488;&#31649;&#29702;&#30028;&#38754;&#20851;&#38381;&#19981;&#38656;&#35201;&#30340;&#21151;&#33021;\nadd_action( 'admin_notices', 'close_unnecessary_functions' );\nfunction close_unnecessary_functions() {\nif ( ! current_user_can( 'manage_options' ) ) {\n  remove_action( 'admin_bar_did_change', 'wp_admin_bar_show_admin_bar', 1000 );\n}\n}<\/code><\/pre><\/li>\n<\/ul>\n<p>&#36825;&#20123;&#31574;&#30053;&#34429;&#28982;&#31616;&#21333;&#65292;&#20294;&#21364;&#26159;&#26500;&#24314;&#19968;&#20010;&#23433;&#20840;&#19988;&#20581;&#22766;WordPress&#31449;&#28857;&#30340;&#22522;&#30784;&#12290;&#23454;&#36341;&#36825;&#20123;&#25216;&#24039;&#65292;&#24744;&#21487;&#20197;&#26174;&#33879;&#25552;&#39640;&#32593;&#31449;&#30340;&#23433;&#20840;&#24615;&#21644;&#29992;&#25143;&#20307;&#39564;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&#20889; Bug&#24037;&#31243;&#24072;&#65306; &#25552;&#39640;WordPress&#32593;&#31449;&#30340;&#20581;&#24247;&#26816;&#26597;&#35780;&#20998;&#26159;&#20445;&#038;#..<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[49,50],"tuisongtax":[],"class_list":["post-1026","post","type-post","status-publish","format-standard","hentry","category-wpdt","tag-rmzn","tag-xsbdtj"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/1026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/comments?post=1026"}],"version-history":[{"count":0,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/1026\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/media?parent=1026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/categories?post=1026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tags?post=1026"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tuisongtax?post=1026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}