{"id":2421,"date":"2025-06-11T02:09:19","date_gmt":"2025-06-10T18:09:19","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/wpcms\/wpdt\/2421.html"},"modified":"2025-06-11T02:09:19","modified_gmt":"2025-06-10T18:09:19","slug":"%e5%a6%82%e4%bd%95%e5%b0%86%e6%82%a8%e7%9a%84wordpress%e7%bd%91%e7%ab%99%e6%8f%90%e4%ba%a4%e5%88%b0google-news%ef%bc%88%e5%88%86%e6%ad%a5%e6%8c%87%e5%8d%97%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.zhaozhao123.cn\/wpcms\/post\/2421.html","title":{"rendered":"\u5982\u4f55\u5c06\u60a8\u7684WordPress\u7f51\u7ad9\u63d0\u4ea4\u5230Google News\uff08\u5206\u6b65\u6307\u5357\uff09"},"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>&#35201;&#23558;&#24744;&#30340;WordPress&#32593;&#31449;&#25552;&#20132;&#21040;Google News&#65292;&#24744;&#38656;&#35201;&#36981;&#24490;&#20197;&#19979;&#27493;&#39588;&#65306;<\/p>\n<ol>\n<li><strong>&#30331;&#24405;&#21040;&#24744;&#30340;WordPress&#21518;&#21488;<\/strong>&#65306;&#39318;&#20808;&#65292;&#25171;&#24320;&#24744;&#30340;WordPress&#31649;&#29702;&#38754;&#26495;&#12290;<\/li>\n<li><strong>&#36827;&#20837;&#35774;&#32622;&#33756;&#21333;<\/strong>&#65306;&#28857;&#20987;&ldquo;&#35774;&#32622;&rdquo;&#25110;&ldquo;&#36873;&#39033;&rdquo;&#33756;&#21333;&#65292;&#28982;&#21518;&#36873;&#25321;&ldquo;&#26032;&#38395;&rdquo;&#36873;&#39033;&#12290;<\/li>\n<li><strong>&#21551;&#29992;&#26032;&#38395;&#21151;&#33021;<\/strong>&#65306;&#22312;&#26032;&#38395;&#35774;&#32622;&#39029;&#38754;&#19978;&#65292;&#30830;&#20445;&ldquo;&#26032;&#38395;&rdquo;&#21151;&#33021;&#24050;&#21551;&#29992;&#12290;&#22914;&#26524;&#26410;&#21551;&#29992;&#65292;&#35831;&#21246;&#36873;&#35813;&#36873;&#39033;&#12290;<\/li>\n<li><strong>&#36755;&#20837;Google News API&#23494;&#38053;<\/strong>&#65306;\n<ul>\n<li>&#22312;&#26032;&#38395;&#35774;&#32622;&#39029;&#38754;&#30340;&#39030;&#37096;&#65292;&#25214;&#21040;&#24182;&#22797;&#21046;Google News API&#23494;&#38053;&#12290;&#36825;&#20010;&#23494;&#38053;&#36890;&#24120;&#20250;&#20986;&#29616;&#22312;Google Developers Console&#20013;&#12290;<\/li>\n<\/ul><\/li>\n<li><strong>&#21019;&#24314;&#26032;&#38395;&#26465;&#30446;&#27169;&#26495;<\/strong>&#65306;\n<ul>\n<li>&#28857;&#20987;&ldquo;&#28155;&#21152;&#26032;&#38395;&#26465;&#30446;&rdquo;&#25353;&#38062;&#65292;&#36825;&#23558;&#22312;&#39029;&#38754;&#24213;&#37096;&#26174;&#31034;&#19968;&#20010;&#25991;&#26412;&#26694;&#20379;&#24744;&#22635;&#20889;&#26032;&#38395;&#26631;&#39064;&#21644;&#25551;&#36848;&#12290;<\/li>\n<\/ul><\/li>\n<li><strong>&#27979;&#35797;&#26032;&#38395;&#21457;&#24067;<\/strong>&#65306;\n<ul>\n<li>&#36755;&#20837;&#19968;&#20123;&#27979;&#35797;&#20449;&#24687;&#65292;&#20363;&#22914;&#65306;&ldquo;[&#24744;&#30340;&#32593;&#31449;&#21517;&#31216;] &ndash; [&#26085;&#26399;]&rdquo;&#65292;&#28982;&#21518;&#20445;&#23384;&#36825;&#20123;&#26465;&#30446;&#12290;Google News&#20250;&#22312;&#20960;&#20998;&#38047;&#20869;&#33258;&#21160;&#21152;&#36733;&#36825;&#20123;&#26465;&#30446;&#12290;<\/li>\n<\/ul><\/li>\n<\/ol>\n<h3>&#31034;&#20363;&#20195;&#30721;<\/h3>\n<p>&#20551;&#35774;&#24744;&#24050;&#32463;&#21551;&#29992;&#20102;Google News&#21151;&#33021;&#65292;&#24744;&#21487;&#20197;&#36890;&#36807;&#20197;&#19979;&#20195;&#30721;&#26469;&#33258;&#21160;&#21457;&#24067;&#26032;&#25991;&#31456;&#65306;<\/p>\n<pre><code class=\"language-php\">&lt;?php\n\/\/ &#33719;&#21462;&#24403;&#21069;&#25991;&#31456;ID\n$current_post_id = get_the_ID();\n\n\/\/ &#21019;&#24314;&#19968;&#20010;&#26032;&#30340;&#26032;&#38395;&#26465;&#30446;\n$news_entry = array(\n    'title' =&gt; '&lt;h1&gt;' . get_the_title() . '&lt;\/h1&gt;',\n    'content' =&gt; '&lt;p&gt;' . get_the_content() . '&lt;\/p&gt;',\n    'link' =&gt; get_permalink(),\n);\n\n\/\/ &#21457;&#24067;&#26032;&#30340;&#26032;&#38395;&#26465;&#30446;\nwp_insert_post($news_entry);\n?&gt;<\/code><\/pre>\n<h3>&#20351;&#29992;&#27493;&#39588;&#21450;&#25928;&#26524;<\/h3>\n<ol>\n<li><strong>&#33719;&#21462;&#24403;&#21069;&#25991;&#31456;ID<\/strong>&#65306;<code>get_the_ID()<\/code>&#20989;&#25968;&#29992;&#20110;&#33719;&#21462;&#24403;&#21069;&#25991;&#31456;&#30340;ID&#12290;<\/li>\n<li><strong>&#21019;&#24314;&#26032;&#30340;&#26032;&#38395;&#26465;&#30446;<\/strong>&#65306;&#36890;&#36807;&#25968;&#32452; <code>$news_entry<\/code> &#23450;&#20041;&#20102;&#26032;&#38395;&#26465;&#30446;&#30340;&#22522;&#26412;&#32467;&#26500;&#65292;&#21253;&#25324;&#26631;&#39064;&#12289;&#20869;&#23481;&#21644;&#38142;&#25509;&#12290;<\/li>\n<li><strong>&#21457;&#24067;&#26032;&#30340;&#26032;&#38395;&#26465;&#30446;<\/strong>&#65306;<code>wp_insert_post($news_entry)<\/code> &#20989;&#25968;&#29992;&#20110;&#23454;&#38469;&#21457;&#24067;&#36825;&#26465;&#26032;&#38395;&#26465;&#30446;&#12290;<\/li>\n<\/ol>\n<p>&#36890;&#36807;&#19978;&#36848;&#27493;&#39588;&#65292;&#24403;&#24744;&#26356;&#26032;&#25110;&#21457;&#24067;&#26032;&#25991;&#31456;&#26102;&#65292;Google News&#23558;&#20250;&#33258;&#21160;&#25235;&#21462;&#24182;&#23637;&#31034;&#36825;&#20123;&#26032;&#38395;&#26465;&#30446;&#12290;&#35831;&#27880;&#24847;&#65292;&#27492;&#36807;&#31243;&#21487;&#33021;&#38656;&#35201;&#19968;&#20123;&#26102;&#38388;&#25165;&#33021;&#29983;&#25928;&#65292;&#22240;&#20026;Google News&#38656;&#35201;&#19968;&#27573;&#26102;&#38388;&#26469;&#29228;&#21462;&#21644;&#22788;&#29702;&#25968;&#25454;&#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><strong>&#35838;&#31243;&#30446;&#26631;&#65306;<\/strong><\/p>\n<ul>\n<li>&#23398;&#20064;&#22914;&#20309;&#20351;&#29992;WordPress&#23558;&#32593;&#31449;&#25552;&#20132;&#21040;Google News&#12290;<\/li>\n<li>&#20102;&#35299;&#22914;&#20309;&#35774;&#32622;&#21644;&#31649;&#29702;Google News&#30340;&#26032;&#38395;&#28304;&#12290;<\/li>\n<\/ul>\n<p><strong>&#35838;&#31243;&#32467;&#26500;&#65306;<\/strong><\/p>\n<ol>\n<li>\n<p><strong>&#20934;&#22791;&#38454;&#27573;<\/strong><\/p>\n<ul>\n<li>&#20934;&#22791;&#22909;&#24744;&#35201;&#25552;&#20132;&#30340;WordPress&#32593;&#31449;&#12290;<\/li>\n<li>&#30830;&#20445;&#24744;&#30340;&#32593;&#31449;&#24050;&#23433;&#35013;&#24182;&#37197;&#32622;&#20102;WordPress&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#21019;&#24314;Google News&#36134;&#25143;<\/strong><\/p>\n<ul>\n<li>&#30331;&#24405;Google Analytics&#25110;Google Ads&#12290;<\/li>\n<li>&#21019;&#24314;&#19968;&#20010;&#26032;&#36134;&#25143;&#65292;&#36873;&#25321;&ldquo;News &amp; Insights&rdquo;&#20316;&#20026;&#20998;&#31867;&#12290;<\/li>\n<li>&#22312;&ldquo;Google News API&rdquo;&#37096;&#20998;&#27880;&#20876;&#19968;&#20010;API&#23494;&#38053;&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#21019;&#24314;Google News Feed<\/strong><\/p>\n<ul>\n<li>&#30331;&#24405;Google News Webmaster Tools&#12290;<\/li>\n<li>&#21019;&#24314;&#19968;&#20010;&#26032;&#30340;Feed&#12290;<\/li>\n<li>&#23558;&#24744;&#30340;&#32593;&#31449;&#38142;&#25509;&#28155;&#21152;&#21040;Feed&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#35774;&#32622;Google News Feed&#30340;&#26631;&#39064;&#12289;&#25551;&#36848;&#21644;&#22270;&#20687;<\/strong><\/p>\n<ul>\n<li>&#35774;&#32622;Feed&#30340;&#26631;&#39064;&#12290;<\/li>\n<li>&#35774;&#32622;Feed&#30340;&#25551;&#36848;&#12290;<\/li>\n<li>&#35774;&#32622;Feed&#30340;&#22270;&#20687;&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#21457;&#24067;&#24744;&#30340;&#32593;&#31449;&#21040;Google News Feed<\/strong><\/p>\n<ul>\n<li>&#25353;&#29031;Google News&#30340;&#25351;&#23548;&#21457;&#24067;&#24744;&#30340;&#32593;&#31449;&#12290;<\/li>\n<li>&#30830;&#20445;&#24744;&#30340;&#32593;&#31449;&#31526;&#21512;&#20182;&#20204;&#30340;&#35268;&#23450;&#12290;<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>&#30417;&#25511;&#21644;&#32500;&#25252;<\/strong><\/p>\n<ul>\n<li>&#30417;&#25511;Google News Feed&#30340;&#29366;&#24577;&#12290;<\/li>\n<li>&#26681;&#25454;&#38656;&#35201;&#35843;&#25972;Feed&#30340;&#20869;&#23481;&#12290;<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>&#31034;&#20363;&#20195;&#30721;&#35828;&#26126;&#65306;<\/strong><\/p>\n<p>&#20197;&#19979;&#26159;&#20351;&#29992;WordPress&#21019;&#24314;Google News Feed&#30340;&#31034;&#20363;&#20195;&#30721;&#65306;<\/p>\n<pre><code class=\"language-php\">\/\/ &#33719;&#21462;&#32593;&#31449;&#30340;URL\n$url = get_bloginfo('url');\n\n\/\/ &#26500;&#24314;Feed&#30340;&#26631;&#39064;&#21644;&#25551;&#36848;\n$title = 'Your WordPress Blog';\n$description = 'A great blog about WordPress and web development';\n\n\/\/ &#26500;&#24314;Feed&#30340;&#22270;&#20687;\n$image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post-&gt;ID), 'full');\n$image_url = $image_url[0];\n\n\/\/ &#26500;&#24314;Feed&#30340;&#25968;&#25454;\n$data = array(\n    'title' =&gt; $title,\n    'description' =&gt; $description,\n    'link' =&gt; $url . '\/post\/' . $post-&gt;ID,\n    'image' =&gt; $image_url\n);\n\n\/\/ &#21457;&#24067;Feed\n$response = wp_remote_post('https:\/\/news.google.com\/news\/feeds\/rss\/your_feed', [\n    'method' =&gt; 'POST',\n    'headers' =&gt; [\n        'Content-Type' =&gt; 'application\/x-www-form-urlencoded'\n    ],\n    'body' =&gt; http_build_query($data),\n]);\n\nif ($response['status'] == 200) {\n    echo \"Feed published successfully!\";\n} else {\n    echo \"Failed to publish feed: \" . $response['error'];\n}<\/code><\/pre>\n<p>&#35831;&#27880;&#24847;&#65292;&#19978;&#36848;&#20195;&#30721;&#20165;&#20026;&#31034;&#20363;&#65292;&#23454;&#38469;&#25805;&#20316;&#26102;&#24212;&#26681;&#25454;Google News&#30340;&#20855;&#20307;&#38656;&#27714;&#36827;&#34892;&#20462;&#25913;&#12290;&#27492;&#22806;&#65292;&#30830;&#20445;&#24744;&#30340;&#32593;&#31449;&#24050;&#27491;&#30830;&#37197;&#32622;&#24182;&#20855;&#26377;&#30456;&#24212;&#30340;&#26435;&#38480;&#25165;&#33021;&#21457;&#24067;&#21040;Google News&#12290;<\/p>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Bug&#32534;&#35793;&#29422; &#35201;&#23558;&#24744;&#30340;WordPress&#32593;&#31449;&#25552;&#20132;&#21040;Google News&#65292;&#24744;&#38656;&#35201;&#36981;..<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[59],"tuisongtax":[],"class_list":["post-2421","post","type-post","status-publish","format-standard","hentry","category-wpdt","tag-pzjc"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/2421","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=2421"}],"version-history":[{"count":0,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/2421\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/media?parent=2421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/categories?post=2421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tags?post=2421"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tuisongtax?post=2421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}