{"id":2402,"date":"2025-06-11T01:53:10","date_gmt":"2025-06-10T17:53:10","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/wpcms\/wpdt\/2402.html"},"modified":"2025-06-14T11:45:28","modified_gmt":"2025-06-14T03:45:28","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8wordpress%e4%b8%ad%e6%b7%bb%e5%8a%a0indexnow%e4%bb%a5%e5%8a%a0%e9%80%9fseo%e7%bb%93%e6%9e%9c","status":"publish","type":"post","link":"https:\/\/www.zhaozhao123.cn\/wpcms\/post\/2402.html","title":{"rendered":"\u5982\u4f55\u5728WordPress\u4e2d\u6dfb\u52a0IndexNow\u4ee5\u52a0\u901fSEO\u7ed3\u679c"},"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<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--1\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/dyA-1-400x300.jpg\" alt=\"Bug&#32534;&#35793;&#29422;\" class=\"wp-image-1842\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<p class=\"my-0\">Bug&#32534;&#35793;&#29422;<\/p>\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;&#22312;WordPress&#20013;&#20351;&#29992;IndexNow&#26469;&#21152;&#36895;&#25628;&#32034;&#24341;&#25806;&#30340;&#32467;&#26524;&#65292;&#25105;&#23558;&#25552;&#20379;&#19968;&#20010;&#31616;&#21333;&#30340;&#25945;&#31243;&#21644;&#31034;&#20363;&#20195;&#30721;&#12290;&#39318;&#20808;&#65292;&#35831;&#30830;&#20445;&#24744;&#30340;WordPress&#23433;&#35013;&#20102;IndexNow&#25554;&#20214;&#12290;&#22914;&#26524;&#24744;&#23578;&#26410;&#23433;&#35013;&#23427;&#65292;&#35831;&#35775;&#38382;&#25554;&#20214;&#21830;&#24215;&#24182;&#25628;&#32034;&ldquo;IndexNow&rdquo;&#65292;&#28982;&#21518;&#25353;&#25351;&#31034;&#23433;&#35013;&#12290;<\/p>\n<h3>&#27493;&#39588; 1: &#23433;&#35013;IndexNow&#25554;&#20214;<\/h3>\n<ol>\n<li>&#30331;&#24405;&#21040;&#24744;&#30340;WordPress&#31649;&#29702;&#21518;&#21488;&#12290;<\/li>\n<li>&#23548;&#33322;&#33267;&ldquo;&#25554;&#20214;&rdquo; -&gt; &ldquo;&#23433;&#35013;&#25554;&#20214;&rdquo;&#12290;<\/li>\n<li>&#22312;&#25628;&#32034;&#26694;&#20013;&#36755;&#20837;&ldquo;IndexNow&rdquo;&#24182;&#26597;&#25214;&#35813;&#25554;&#20214;&#12290;<\/li>\n<li>&#25214;&#21040;&#25554;&#20214;&#21518;&#28857;&#20987;&ldquo;&#23433;&#35013;&rdquo;&#25353;&#38062;&#12290;<\/li>\n<li>&#28857;&#20987;&ldquo;&#28608;&#27963;&rdquo;&#23436;&#25104;&#23433;&#35013;&#36807;&#31243;&#12290;<\/li>\n<\/ol>\n<h3>&#27493;&#39588; 2: &#37197;&#32622;IndexNow<\/h3>\n<p>&#19968;&#26086;&#25554;&#20214;&#23433;&#35013;&#23436;&#27605;&#65292;&#24744;&#21487;&#33021;&#38656;&#35201;&#23545;&#20854;&#36827;&#34892;&#19968;&#20123;&#22522;&#26412;&#30340;&#37197;&#32622;&#12290;&#36825;&#36890;&#24120;&#21253;&#25324;&#35774;&#32622;IndexNow&#30340;URL&#12289;&#32034;&#24341;&#25991;&#20214;&#30340;&#20301;&#32622;&#20197;&#21450;&#26159;&#21542;&#21551;&#29992;HTTPS&#31561;&#36873;&#39033;&#12290;<\/p>\n<h4>&#31034;&#20363;&#37197;&#32622;&#65306;<\/h4>\n<pre><code class=\"language-php\">\/\/ &#25351;&#23450;IndexNow&#30340;URL\ndefine('INDEXNOW_URL', 'http:\/\/your-indexnow-site.com');\n\n\/\/ &#35774;&#32622;&#32034;&#24341;&#25991;&#20214;&#30340;&#20301;&#32622;\ndefine('INDEXNOW_INDEX_FILE', '\/path\/to\/your\/indexfile.txt');<\/code><\/pre>\n<p>&#20445;&#23384;&#36825;&#20123;&#37197;&#32622;&#21518;&#65292;IndexNow&#24212;&#35813;&#20250;&#33258;&#21160;&#22788;&#29702;&#24744;&#30340;&#32593;&#31449;&#32034;&#24341;&#35831;&#27714;&#12290;<\/p>\n<h3>&#27493;&#39588; 3: &#27979;&#35797;IndexNow&#21151;&#33021;<\/h3>\n<p>&#25171;&#24320;&#27983;&#35272;&#22120;&#24182;&#35775;&#38382;&#24744;&#30340;WordPress&#31449;&#28857;&#65292;&#28982;&#21518;&#23581;&#35797;&#21152;&#36733;&#20219;&#20309;&#39029;&#38754;&#12290;&#22914;&#26524;&#19968;&#20999;&#27491;&#24120;&#65292;&#24744;&#24212;&#35813;&#20250;&#22312;IndexNow&#26381;&#21153;&#22120;&#19978;&#30475;&#21040;&#24744;&#21018;&#21018;&#21019;&#24314;&#30340;&#32034;&#24341;&#25991;&#20214;&#12290;&#26816;&#26597;&#26085;&#24535;&#25110;&#25511;&#21046;&#38754;&#26495;&#30830;&#35748;IndexNow&#27491;&#22312;&#36816;&#34892;&#24182;&#19988;&#27809;&#26377;&#20986;&#29616;&#38169;&#35823;&#12290;<\/p>\n<h3>&#31034;&#20363;&#20195;&#30721;&#19982;&#25928;&#26524;<\/h3>\n<p>&#20197;&#19979;&#26159;&#19968;&#20010;&#31616;&#21333;&#30340;PHP&#31034;&#20363;&#65292;&#29992;&#20110;&#21521;IndexNow&#21457;&#36865;&#35831;&#27714;&#24182;&#33719;&#21462;&#20854;&#21709;&#24212;&#65306;<\/p>\n<pre><code class=\"language-php\">&lt;?php\n\/\/ &#33719;&#21462;IndexNow&#30340;URL\n$indexNowUrl = define('INDEXNOW_URL', 'http:\/\/your-indexnow-site.com');\n\n\/\/ &#21457;&#36865;GET&#35831;&#27714;&#21040;IndexNow\n$response = file_get_contents($indexNowUrl . '\/api\/v1\/index?query=example');\n\n\/\/ &#36755;&#20986;&#21709;&#24212;\necho $response;\n?&gt;<\/code><\/pre>\n<p>&#36825;&#20010;&#31034;&#20363;&#23637;&#31034;&#20102;&#22914;&#20309;&#36890;&#36807;PHP&#33050;&#26412;&#21521;IndexNow&#21457;&#36865;GET&#35831;&#27714;&#12290;&#35831;&#26681;&#25454;&#23454;&#38469;&#24773;&#20917;&#35843;&#25972;<code>$indexNowUrl<\/code>&#21644;<code>'\/api\/v1\/index'<\/code>&#37096;&#20998;&#20197;&#21305;&#37197;&#24744;&#30340;&#23454;&#38469;URL&#32467;&#26500;&#12290;<\/p>\n<h3>&#32467;&#35770;<\/h3>\n<p>&#36890;&#36807;&#19978;&#36848;&#27493;&#39588;&#65292;&#24744;&#21487;&#20197;&#36731;&#26494;&#22320;&#22312;WordPress&#20013;&#20351;&#29992;IndexNow&#25554;&#20214;&#26469;&#21152;&#36895;&#25628;&#32034;&#24341;&#25806;&#30340;&#32467;&#26524;&#12290;&#36825;&#19981;&#20165;&#26377;&#21161;&#20110;&#25552;&#39640;&#32593;&#31449;&#30340;&#25490;&#21517;&#65292;&#36824;&#33021;&#20026;&#29992;&#25143;&#25552;&#20379;&#26356;&#24555;&#30340;&#27983;&#35272;&#20307;&#39564;&#12290;&#35760;&#24471;&#23450;&#26399;&#26816;&#26597;IndexNow&#30340;&#26085;&#24535;&#21644;&#24615;&#33021;&#30417;&#25511;&#24037;&#20855;&#65292;&#20197;&#30830;&#20445;&#25554;&#20214;&#30340;&#27491;&#24120;&#36816;&#34892;&#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<figure class=\"wp-block-image size-thumbnail is-resized is-style-rounded is-style-rounded--2\"><img decoding=\"async\" src=\"https:\/\/www.zhaozhao123.cn\/myitems\/images\/sites16\/2025\/06\/zp-400x300.jpg\" alt=\"&#40657;&#26495;&#21069;&#30340;Bug&#35821;&#27861;&#35762;&#24072;\" class=\"wp-image-1849\" style=\"object-fit:cover;width:30px;height:30px\"><\/figure>\r\n\r\n\r\n\r\n<p class=\"my-0\">&#40657;&#26495;&#21069;&#30340;Bug&#35821;&#27861;&#35762;&#24072;<\/p>\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>&#22312;WordPress&#20013;&#28155;&#21152;IndexNow&#20197;&#21152;&#36895;SEO&#32467;&#26524;&#26159;&#19968;&#31181;&#26377;&#25928;&#30340;&#20248;&#21270;&#31574;&#30053;&#65292;&#21487;&#20197;&#24110;&#21161;&#32593;&#31449;&#26356;&#24555;&#22320;&#34987;&#25628;&#32034;&#24341;&#25806;&#25910;&#24405;&#21644;&#25490;&#21517;&#12290;&#20197;&#19979;&#26159;&#19968;&#20123;&#27493;&#39588;&#21644;&#31034;&#20363;&#20195;&#30721;&#26469;&#24110;&#21161;&#24744;&#23454;&#29616;&#36825;&#19968;&#30446;&#26631;&#65306;<\/p>\n<h3>&#27493;&#39588; 1: &#23433;&#35013;&#21644;&#28608;&#27963;&#25554;&#20214;<\/h3>\n<p>&#39318;&#20808;&#65292;&#30830;&#20445;&#24744;&#30340;WordPress&#31449;&#28857;&#24050;&#23433;&#35013;&#24182;&#28608;&#27963;&#20102;<code>IndexNow<\/code>&#25554;&#20214;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;&#65306;<\/strong><\/p>\n<pre><code class=\"language-php\">\/\/ &#22312;wp-content\/plugins&#30446;&#24405;&#19979;&#25214;&#21040;IndexNow&#25554;&#20214;&#25991;&#20214;&#22841;\n$indexnow_path = plugin_dir_path(__FILE__);\n$plugin_url = plugin_dir_url(__FILE__);\n\n\/\/ &#21152;&#36733;&#25554;&#20214;\nrequire_once($indexnow_path . 'includes\/class-indexnow.php');\nrequire_once($indexnow_path . 'includes\/functions.php');\n\n\/\/ &#28608;&#27963;&#25554;&#20214;\nnew IndexNow();<\/code><\/pre>\n<h3>&#27493;&#39588; 2: &#37197;&#32622;&#32034;&#24341;&#35774;&#32622;<\/h3>\n<ul>\n<li><strong>&#21551;&#29992;&#33258;&#23450;&#20041;URL<\/strong>: &#36825;&#23558;&#20801;&#35768;&#29992;&#25143;&#33258;&#23450;&#20041;&#32034;&#24341;&#39029;&#38754;&#12290;<\/li>\n<li><strong>&#25351;&#23450;&#20027;&#39064;\/&#25991;&#31456;&#20998;&#31867;<\/strong>: &#36873;&#25321;&#21512;&#36866;&#30340;&#31867;&#21035;&#25110;&#20027;&#39064;&#20197;&#20415;&#20110;&#25628;&#32034;&#12290;<\/li>\n<\/ul>\n<p><strong>&#31034;&#20363;&#20195;&#30721;&#65288;&#21551;&#29992;&#33258;&#23450;&#20041;URL&#65289;&#65306;<\/strong><\/p>\n<pre><code class=\"language-php\">\/\/ &#33719;&#21462;&#24403;&#21069;&#20027;&#39064;ID\n$current_theme_id = get_theme_mod('theme_id', false);\n\n\/\/ &#21019;&#24314;&#33258;&#23450;&#20041;URL&#35268;&#21017;\n$url_rule = new WP_URL_Rule('\/^' . $current_theme_id . '\/');\n\n\/\/ &#23558;&#33258;&#23450;&#20041;URL&#35268;&#21017;&#24212;&#29992;&#20110;&#20027;&#39064;&#30340;&#26681;&#36335;&#24452;\nadd_filter('site_url', function ($url) use ($url_rule) {\n    return apply_filters('custom_site_url', $url_rule-&gt;apply_url($url));\n}, 999);<\/code><\/pre>\n<h3>&#27493;&#39588; 3: &#28155;&#21152;&#20851;&#38190;&#35789;&#21040;&#32034;&#24341;<\/h3>\n<p>&#20351;&#29992;<code>meta-box<\/code>&#21151;&#33021;&#21487;&#20197;&#26041;&#20415;&#22320;&#20026;&#27599;&#20010;&#20027;&#39064;&#21019;&#24314;&#19968;&#20010;&#20851;&#38190;&#35789;&#31649;&#29702;&#26694;&#65292;&#20174;&#32780;&#33258;&#21160;&#22686;&#21152;&#20851;&#38190;&#35789;&#21040;&#32034;&#24341;&#12290;<\/p>\n<p><strong>&#31034;&#20363;&#20195;&#30721;&#65306;<\/strong><\/p>\n<pre><code class=\"language-php\">\/\/ &#35774;&#32622;&#20851;&#38190;&#35789;&#31649;&#29702;&#22120;\nfunction add_keywords_to_index() {\n    global $wpdb;\n    $keywords_table_name = $wpdb-&gt;prefix . 'wpseo_keyword';\n\n    \/\/ &#21019;&#24314;&#20851;&#38190;&#35789;&#34920;\n    if (!is_multisite()) {\n        $sql = \"CREATE TABLE IF NOT EXISTS `$keywords_table_name` (\n            `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n            `keyword` varchar(50) DEFAULT '' NOT NULL,\n            PRIMARY KEY (`id`)\n        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;\";\n        $wpdb-&gt;query($sql);\n    }\n\n    \/\/ &#25554;&#20837;&#20851;&#38190;&#35789;&#25968;&#25454;\n    if (get_option('wpseo_keywords') !== null &amp;&amp; is_array(get_option('wpseo_keywords'))) {\n        foreach (get_option('wpseo_keywords') as $key =&gt; $value) {\n            $sql = \"INSERT INTO `$keywords_table_name`(`keyword`) VALUES ('\" . esc_sql($value) . \"')\";\n            $wpdb-&gt;query($sql);\n        }\n    }\n}\nadd_action('init', 'add_keywords_to_index');<\/code><\/pre>\n<p>&#36890;&#36807;&#20197;&#19978;&#27493;&#39588;&#65292;&#24744;&#21487;&#20197;&#26377;&#25928;&#22320;&#21033;&#29992;WordPress&#25552;&#20379;&#30340;&#25554;&#20214;&#21644;&#21151;&#33021;&#26469;&#25552;&#39640;&#20854;SEO&#24615;&#33021;&#12290;&#35831;&#27880;&#24847;&#65292;&#36825;&#20123;&#31034;&#20363;&#20195;&#30721;&#38656;&#35201;&#26681;&#25454;&#24744;&#30340;&#20855;&#20307;&#38656;&#27714;&#36827;&#34892;&#35843;&#25972;&#65292;&#20363;&#22914;&#65292;&#22914;&#26524;&#24744;&#24076;&#26395;&#20026;&#29305;&#23450;&#30340;&#20027;&#39064;&#25110;&#25991;&#31456;&#31867;&#22411;&#28155;&#21152;&#32034;&#24341;&#65292;&#35831;&#30456;&#24212;&#22320;&#20462;&#25913;&#37197;&#32622;&#36873;&#39033;&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Bug&#32534;&#35793;&#29422; &#20026;&#20102;&#24110;&#21161;&#24744;&#22312;WordPress&#20013;&#20351;&#29992;IndexNow&#26469;&#21152;&#36895;&#25628;&#32034;&#038;#2..<\/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":[3192,59],"tuisongtax":[],"class_list":["post-2402","post","type-post","status-publish","format-standard","hentry","category-wpdt","tag-tswzjs","tag-pzjc"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/2402","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=2402"}],"version-history":[{"count":0,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/2402\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/media?parent=2402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/categories?post=2402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tags?post=2402"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tuisongtax?post=2402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}