{"id":120,"date":"2025-03-31T11:16:11","date_gmt":"2025-03-31T03:16:11","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/wpcms\/120.html"},"modified":"2025-12-11T10:11:11","modified_gmt":"2025-12-11T02:11:11","slug":"%e4%bf%ae%e6%94%b9wordpress%e5%8f%91%e5%b8%83%e6%96%87%e7%ab%a0%e7%9a%84%e8%b5%b7%e5%a7%8bid%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"bjjc","link":"https:\/\/www.zhaozhao123.cn\/wpcms\/bjjc\/120.html","title":{"rendered":"\u4fee\u6539WordPress\u53d1\u5e03\u6587\u7ae0\u7684\u8d77\u59cbid\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u5728 WordPress \u4e2d\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6587\u7ae0\u3001\u9875\u9762\u3001\u5a92\u4f53\u7b49\u5185\u5bb9\u7684 ID \u662f\u7531\u6570\u636e\u5e93\u81ea\u52a8\u751f\u6210\u7684\uff0c\u5e76\u4e14\u662f\u9012\u589e\u7684\u3002\u5982\u679c\u4f60\u60f3\u4fee\u6539\u53d1\u5e03\u6587\u7ae0\u7684\u8d77\u59cb ID\uff08\u4f8b\u5982\u8ba9\u65b0\u6587\u7ae0\u4ece\u67d0\u4e2a\u7279\u5b9a\u7684\u6570\u5b57\u5f00\u59cb\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u5b9e\u73b0\uff1a<\/p><hr class=\"wp-block-separator has-alpha-channel-opacity\"><h3 class=\"wp-block-heading\">\u65b9\u6cd5 1\uff1a\u901a\u8fc7\u63d2\u5165\u865a\u62df\u6570\u636e\u7684\u65b9\u5f0f<\/h3><p>\u8fd9\u662f\u6700\u5e38\u89c1\u548c\u5b89\u5168\u7684\u65b9\u6cd5\uff0c\u9002\u7528\u4e8e\u4e0d\u60f3\u76f4\u63a5\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u60c5\u51b5\u3002<\/p><ol class=\"wp-block-list\">\n<li><strong>\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u811a\u672c<\/strong>\uff1a<br>\u5728\u4f60\u7684 WordPress \u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 PHP \u6587\u4ef6\uff08\u4f8b\u5982 <code>set_id.php<\/code>\uff09\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/li>\n<\/ol><pre class=\"wp-block-code\"><code>   &lt;?php\n   require_once('wp-load.php');\n\n   $start_id = 1000; \/\/ \u8bbe\u7f6e\u4f60\u5e0c\u671b\u7684\u8d77\u59cb ID\n   $current_id = wp_insert_post(array(\n       'post_title'    =&gt; 'Dummy Post',\n       'post_content'  =&gt; 'This is a dummy post to set the ID.',\n       'post_status'   =&gt; 'draft', \/\/ \u521b\u5efa\u4e3a\u8349\u7a3f\u72b6\u6001\n       'post_author'   =&gt; 1,       \/\/ \u8bbe\u7f6e\u4f5c\u8005 ID\n   ));\n\n   while ($current_id &lt; $start_id) {\n       wp_delete_post($current_id, true); \/\/ \u5220\u9664\u521a\u624d\u521b\u5efa\u7684\u865a\u62df\u6587\u7ae0\n       $current_id = wp_insert_post(array(\n           'post_title'    =&gt; 'Dummy Post',\n           'post_content'  =&gt; 'This is a dummy post to set the ID.',\n           'post_status'   =&gt; 'draft',\n           'post_author'   =&gt; 1,\n       ));\n   }\n\n   echo \"Posts have been created up to ID: \" . $current_id;<\/code><\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u8fd0\u884c\u811a\u672c<\/strong>\uff1a<br>\u5c06\u8be5\u811a\u672c\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u540e\uff0c\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee\u5b83\uff08\u4f8b\u5982 <code>https:\/\/yourwebsite.com\/set_id.php<\/code>\uff09\u3002\u811a\u672c\u4f1a\u81ea\u52a8\u521b\u5efa\u865a\u62df\u6587\u7ae0\uff0c\u76f4\u5230\u8fbe\u5230\u4f60\u6307\u5b9a\u7684\u8d77\u59cb ID\u3002<\/li>\n\n\n\n<li><strong>\u5220\u9664\u811a\u672c<\/strong>\uff1a<br>\u811a\u672c\u6267\u884c\u5b8c\u6210\u540e\uff0c\u8bf7\u7acb\u5373\u5220\u9664\u8be5\u6587\u4ef6\u4ee5\u907f\u514d\u5b89\u5168\u98ce\u9669\u3002<\/li>\n<\/ol><hr class=\"wp-block-separator has-alpha-channel-opacity\"><h3 class=\"wp-block-heading\">\u65b9\u6cd5 2\uff1a\u76f4\u63a5\u4fee\u6539\u6570\u636e\u5e93<\/h3><p>\u5982\u679c\u4f60\u719f\u6089\u6570\u636e\u5e93\u64cd\u4f5c\uff0c\u53ef\u4ee5\u76f4\u63a5\u4fee\u6539 WordPress \u6570\u636e\u5e93\u4e2d\u7684\u81ea\u589e ID\u3002\u8fd9\u79cd\u65b9\u5f0f\u98ce\u9669\u8f83\u9ad8\uff0c\u5efa\u8bae\u5148\u5907\u4efd\u6570\u636e\u5e93\u3002<\/p><ol class=\"wp-block-list\">\n<li><strong>\u767b\u5f55\u5230\u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177<\/strong>\uff1a<br>\u4f7f\u7528 phpMyAdmin \u6216\u5176\u4ed6\u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177\u8fde\u63a5\u5230\u4f60\u7684 WordPress \u6570\u636e\u5e93\u3002<\/li>\n\n\n\n<li><strong>\u627e\u5230 <code>wp_posts<\/code> \u8868<\/strong>\uff1a<br>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cWordPress \u7684\u6587\u7ae0\u5b58\u50a8\u5728 <code>wp_posts<\/code> \u8868\u4e2d\uff08\u5982\u679c\u4f60\u66f4\u6539\u4e86\u8868\u524d\u7f00\uff0c\u8bf7\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8c03\u6574\uff09\u3002<\/li>\n\n\n\n<li><strong>\u4fee\u6539\u81ea\u589e\u503c<\/strong>\uff1a<br>\u6267\u884c\u4ee5\u4e0b SQL \u67e5\u8be2\u6765\u4fee\u6539 <code>wp_posts<\/code> \u8868\u7684\u81ea\u589e ID\uff1a<\/li>\n<\/ol><pre class=\"wp-block-code\"><code>   ALTER TABLE wp_posts AUTO_INCREMENT = 1000;<\/code><\/pre><p>\u8fd9\u91cc\u7684 <code>1000<\/code> \u662f\u4f60\u5e0c\u671b\u7684\u8d77\u59cb ID\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u4fee\u6539\u3002<\/p><ol start=\"4\" class=\"wp-block-list\">\n<li><strong>\u9a8c\u8bc1\u7ed3\u679c<\/strong>\uff1a<br>\u521b\u5efa\u4e00\u7bc7\u65b0\u6587\u7ae0\uff0c\u68c0\u67e5\u5176 ID \u662f\u5426\u4ece\u4f60\u8bbe\u7f6e\u7684\u503c\u5f00\u59cb\u3002<\/li>\n<\/ol><hr class=\"wp-block-separator has-alpha-channel-opacity\"><h3 class=\"wp-block-heading\">\u6ce8\u610f\u4e8b\u9879<\/h3><ul class=\"wp-block-list\">\n<li><strong>\u63d2\u4ef6\u548c\u4e3b\u9898\u517c\u5bb9\u6027<\/strong>\uff1a\u67d0\u4e9b\u63d2\u4ef6\u6216\u4e3b\u9898\u53ef\u80fd\u4f1a\u4f9d\u8d56\u6587\u7ae0 ID \u6765\u5de5\u4f5c\uff0c\u968f\u610f\u4fee\u6539 ID \u53ef\u80fd\u4f1a\u5bfc\u81f4\u610f\u5916\u95ee\u9898\u3002<\/li>\n\n\n\n<li><strong>\u5907\u4efd\u6570\u636e\u5e93<\/strong>\uff1a\u65e0\u8bba\u4f7f\u7528\u54ea\u79cd\u65b9\u6cd5\uff0c\u90fd\u5f3a\u70c8\u5efa\u8bae\u5728\u64cd\u4f5c\u4e4b\u524d\u5907\u4efd\u6570\u636e\u5e93\u3002<\/li>\n\n\n\n<li><strong>\u4ec5\u5f71\u54cd\u65b0\u5185\u5bb9<\/strong>\uff1a\u4e0a\u8ff0\u65b9\u6cd5\u53ea\u4f1a\u5f71\u54cd\u672a\u6765\u53d1\u5e03\u7684\u5185\u5bb9\uff0c\u4e0d\u4f1a\u6539\u53d8\u5df2\u6709\u7684\u6587\u7ae0 ID\u3002<\/li>\n<\/ul><hr class=\"wp-block-separator has-alpha-channel-opacity\"><p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u6210\u529f\u4fee\u6539 WordPress \u53d1\u5e03\u6587\u7ae0\u7684\u8d77\u59cb ID\u3002\u5982\u679c\u4f60\u5bf9\u6570\u636e\u5e93\u64cd\u4f5c\u4e0d\u719f\u6089\uff0c\u63a8\u8350\u4f7f\u7528\u7b2c\u4e00\u79cd\u65b9\u6cd5\u4ee5\u786e\u4fdd\u5b89\u5168\u6027\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u5728 WordPress \u4e2d\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6587\u7ae0\u3001\u9875\u9762\u3001\u5a92\u4f53\u7b49\u5185\u5bb9\u7684 ID \u662f\u7531\u6570\u636e\u5e93\u81ea\u52a8\u751f\u6210\u7684\uff0c\u5e76\u4e14\u662f\u9012\u589e\u7684\u3002\u5982\u679c\u4f60\u60f3\u4fee\u6539\u53d1\u5e03\u6587\u7ae0\u7684\u8d77\u59cb ID\uff08\u4f8b\u5982\u8ba9\u65b0\u6587\u7ae0\u4ece\u67d0\u4e2a\u7279\u5b9a\u7684\u6570\u5b57\u5f00\u59cb\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u5b9e\u73b0\uff1a \u65b9\u6cd5 1\uff1a\u901a\u8fc7\u63d2\u5165\u865a\u62df\u6570\u636e\u7684\u65b9\u5f0f \u8fd9\u662f\u6700\u5e38\u89c1\u548c\u5b89\u5168\u7684\u65b9\u6cd5\uff0c\u9002\u7528\u4e8e\u4e0d\u60f3\u76f4\u63a5\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u60c5\u51b5\u3002 \u65b9\u6cd5 2\uff1a\u76f4\u63a5\u4fee\u6539\u6570\u636e\u5e93 ..<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":true},"tags":[],"bjjc2nav":[34],"tuisongtax":[],"class_list":["post-120","bjjc","type-bjjc","status-publish","hentry","bjjc2nav-wptspz"],"acf":{"qian_art_seotitle":"\u4fee\u6539WordPress\u53d1\u5e03\u6587\u7ae0\u7684\u8d77\u59cbid\u7684\u65b9\u6cd5","qian_art_seotitle_source":{"label":"SEO\u6807\u9898","type":"text","formatted_value":"\u4fee\u6539WordPress\u53d1\u5e03\u6587\u7ae0\u7684\u8d77\u59cbid\u7684\u65b9\u6cd5"},"qian_art_seokws":"","qian_art_seokws_source":{"label":"SEO\u5173\u952e\u8bcd","type":"text","formatted_value":""},"qian_art_stzhong":"\u4fee\u6539\u53d1\u5e03\u6587\u7ae0\u7684\u8d77\u59cbID","qian_art_stzhong_source":{"label":"\u4e2d | \u77ed\u6807\u9898","type":"text","formatted_value":"\u4fee\u6539\u53d1\u5e03\u6587\u7ae0\u7684\u8d77\u59cbID"}},"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/bjjc\/120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/bjjc"}],"about":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/types\/bjjc"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/users\/1"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/media?parent=120"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tags?post=120"},{"taxonomy":"bjjc2nav","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/bjjc2nav?post=120"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tuisongtax?post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}