{"id":5896,"date":"2024-08-21T09:01:48","date_gmt":"2024-08-21T01:01:48","guid":{"rendered":"http:\/\/wordpress.jiyun.net\/?p=5896"},"modified":"2025-07-27T17:02:45","modified_gmt":"2025-07-27T09:02:45","slug":"wordpress%e7%9f%ad%e4%bb%a3%e7%a0%81%e6%80%8e%e4%b9%88%e5%9c%a8%e5%bd%93%e5%89%8d%e6%96%87%e7%ab%a0%e5%86%85%e5%bc%95%e7%94%a8%e8%af%84%e8%ae%ba","status":"publish","type":"post","link":"http:\/\/puo.cn\/?p=5896","title":{"rendered":"WordPress\u77ed\u4ee3\u7801\u600e\u4e48\u5728\u5f53\u524d\u6587\u7ae0\u5185\u5f15\u7528\u8bc4\u8bba"},"content":{"rendered":"<p>\u6765\u81ea\u4e00\uff1ahttps:\/\/cloud.tencent.com\/developer\/article\/1429914<\/p>\n<p>&nbsp;<\/p>\n<p>\u6765\u81ea\u4e8c\uff1a<\/p>\n<p>\u5728WordPress\u4e2d\u94fe\u63a5\u5230\u7279\u5b9a\u7559\u8a00\u7684\u697c\u5c42\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b9e\u73b0\uff1a<\/p>\n<ol>\n<li><strong>\u627e\u5230\u7559\u8a00\u7684ID<\/strong>\uff1a\n<ul>\n<li>\u767b\u5f55\u5230WordPress\u7ba1\u7406\u540e\u53f0\u3002<\/li>\n<li>\u5bfc\u822a\u5230\u201c\u8bc4\u8bba\u201d\u90e8\u5206\u3002<\/li>\n<li>\u627e\u5230\u60a8\u60f3\u8981\u94fe\u63a5\u7684\u7279\u5b9a\u7559\u8a00\uff0c\u70b9\u51fb\u5b83\u65c1\u8fb9\u7684\u201c\u7f16\u8f91\u201d\u94fe\u63a5\u3002<\/li>\n<li>\u5728\u6d4f\u89c8\u5668\u5730\u5740\u680f\u6216\u8005\u7f16\u8f91\u9875\u9762\u7684URL\u4e2d\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u4e00\u4e2a\u7c7b\u4f3c\u4e8e\u00a0<code>?p=\u8bc4\u8bbaID<\/code>\u00a0\u7684\u53c2\u6570\uff0c\u8fd9\u91cc\u7684\u201c\u8bc4\u8bbaID\u201d\u5c31\u662f\u60a8\u9700\u8981\u7684\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u6784\u9020\u94fe\u63a5<\/strong>\uff1a\n<ul>\n<li>\u5728\u60a8\u7684\u6587\u7ae0\u6216\u9875\u9762\u7f16\u8f91\u5668\u4e2d\uff0c\u8f93\u5165\u4ee5\u4e0b\u683c\u5f0f\u7684\u94fe\u63a5\uff1a\n<div class=\\\"language language-\\\">\n<div class=\\\"top\\\">\n<div class=\\\"language\\\"><\/div>\n<div id=\\\"copy-button\\\" class=\\\"copy-button\\\">\u590d\u5236<\/div>\n<\/div>\n<pre class=\\\"hljs\\\"><code>&lt;a href=\\\"&lt;?php echo get_permalink(); ?&gt;#comment-&lt;?php echo \u8bc4\u8bbaID; ?&gt;\\\"&gt;\u94fe\u63a5\u6587\u672c&lt;\/a&gt;\n<\/code><\/pre>\n<\/div>\n<p>\u8bf7\u5c06\u201c\u8bc4\u8bbaID\u201d\u66ff\u6362\u6210\u60a8\u4e4b\u524d\u627e\u5230\u7684\u5b9e\u9645\u8bc4\u8bbaID\u3002<\/li>\n<\/ul>\n<p>\u6216\u8005\uff0c\u5982\u679c\u60a8\u4e0d\u4f7f\u7528PHP\u4ee3\u7801\uff0c\u53ef\u4ee5\u76f4\u63a5\u5728HTML\u7f16\u8f91\u5668\u4e2d\u624b\u52a8\u521b\u5efa\u94fe\u63a5\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<div class=\\\"language language-\\\">\n<div class=\\\"top\\\">\n<div class=\\\"language\\\"><\/div>\n<div id=\\\"copy-button\\\" class=\\\"copy-button\\\">\u590d\u5236<\/div>\n<\/div>\n<pre class=\\\"hljs\\\"><code>&lt;a href=\\\"http:\/\/\u60a8\u7684\u7f51\u7ad9\u5730\u5740\/\u6587\u7ae0\u56fa\u5b9a\u94fe\u63a5#comment-\u8bc4\u8bbaID\\\"&gt;\u94fe\u63a5\u6587\u672c&lt;\/a&gt;\n<\/code><\/pre>\n<\/div>\n<p>\u540c\u6837\uff0c\u5c06\u201chttp:\/\/\u60a8\u7684\u7f51\u7ad9\u5730\u5740\/\u6587\u7ae0\u56fa\u5b9a\u94fe\u63a5\u201d\u66ff\u6362\u6210\u60a8\u6587\u7ae0\u7684\u5b9e\u9645URL\uff0c\u5e76\u5c06\u201c\u8bc4\u8bbaID\u201d\u66ff\u6362\u6210\u5b9e\u9645\u7684\u8bc4\u8bbaID\u3002<\/li>\n<li><strong>\u4f7f\u7528\u77ed\u4ee3\u7801<\/strong>\uff1a\n<ul>\n<li>\u5982\u679c\u60a8\u7684\u4e3b\u9898\u652f\u6301\u77ed\u4ee3\u7801\uff0c\u60a8\u4e5f\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u77ed\u4ee3\u7801\u6765\u7b80\u5316\u8fd9\u4e2a\u8fc7\u7a0b\u3002\u8fd9\u901a\u5e38\u9700\u8981\u4e00\u4e9bPHP\u7f16\u7a0b\u77e5\u8bc6\uff0c\u60a8\u53ef\u4ee5\u5728\u4e3b\u9898\u7684<code>functions.php<\/code>\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a\n<div class=\\\"language language-php\\\">\n<div class=\\\"top\\\">\n<div class=\\\"language\\\">php<\/div>\n<div id=\\\"copy-button\\\" class=\\\"copy-button\\\">\u590d\u5236<\/div>\n<\/div>\n<pre class=\\\"hljs\\\"><code><span class=\\\"hljs-function\\\"><span class=\\\"hljs-keyword\\\">function<\/span> <span class=\\\"hljs-title\\\">comment_link_shortcode<\/span>(<span class=\\\"hljs-params\\\"><span class=\\\"hljs-variable\\\">$atts<\/span><\/span>) <\/span>{\n    <span class=\\\"hljs-title function_ invoke__\\\">extract<\/span>(<span class=\\\"hljs-title function_ invoke__\\\">shortcode_atts<\/span>(<span class=\\\"hljs-keyword\\\">array<\/span>(\n        <span class=\\\"hljs-string\\\">\\'id\\'<\/span> =&gt; <span class=\\\"hljs-literal\\\">null<\/span>,\n    ), <span class=\\\"hljs-variable\\\">$atts<\/span>));\n\n    <span class=\\\"hljs-keyword\\\">return<\/span> <span class=\\\"hljs-string\\\">\\'&lt;a href=\\\"\\'<\/span> . <span class=\\\"hljs-title function_ invoke__\\\">get_permalink<\/span>(<span class=\\\"hljs-variable\\\">$id<\/span>) . <span class=\\\"hljs-string\\\">\\'#comment-\\'<\/span> .<span class=\\\"hljs-variable\\\">$id<\/span> . <span class=\\\"hljs-string\\\">\\'\\\"&gt;\u94fe\u63a5\u6587\u672c&lt;\/a&gt;\\'<\/span>;\n}\n<span class=\\\"hljs-title function_ invoke__\\\">add_shortcode<\/span>(<span class=\\\"hljs-string\\\">\\'comment_link\\'<\/span>, <span class=\\\"hljs-string\\\">\\'comment_link_shortcode\\'<\/span>);\n<\/code><\/pre>\n<\/div>\n<\/li>\n<li>\u4f7f\u7528\u65b9\u6cd5\uff1a\u5728\u6587\u7ae0\u7f16\u8f91\u5668\u4e2d\u6dfb\u52a0\u00a0<code>[comment_link id=\\\"\u8bc4\u8bbaID\\\"]\u94fe\u63a5\u6587\u672c[\/comment_link]<\/code>\uff0c\u66ff\u6362\u201c\u8bc4\u8bbaID\u201d\u548c\u201c\u94fe\u63a5\u6587\u672c\u201d\u5373\u53ef\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u8bf7\u8bb0\u5f97\uff0c\u5982\u679c\u60a8\u76f4\u63a5\u5728\u6587\u7ae0\u5185\u5bb9\u4e2d\u63d2\u5165\u94fe\u63a5\uff0c\u786e\u4fdd\u5c06\u201c\u94fe\u63a5\u6587\u672c\u201d\u66ff\u6362\u4e3a\u60a8\u5e0c\u671b\u663e\u793a\u7684\u6587\u5b57\u3002<\/p>\n<p>\u4ee5\u4e0a\u65b9\u6cd5\u4e2d\uff0c\u7528\u6237\u70b9\u51fb\u94fe\u63a5\u540e\uff0c\u5c06\u4f1a\u76f4\u63a5\u8df3\u8f6c\u5230\u6587\u7ae0\u9875\u9762\u7684\u6307\u5b9a\u8bc4\u8bba\u4f4d\u7f6e\u3002\u5982\u679c\u60a8\u7684WordPress\u4e3b\u9898\u5df2\u7ecf\u4e3a\u8bc4\u8bba\u6dfb\u52a0\u4e86\u951a\u70b9\uff0c\u90a3\u4e48\u8fd9\u4e9b\u65b9\u6cd5\u5c06\u4f1a\u5f88\u6709\u6548\u3002\u5982\u679c\u4e3b\u9898\u6ca1\u6709\u6dfb\u52a0\u951a\u70b9\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u5728\u4e3b\u9898\u7684\u8bc4\u8bba\u6a21\u677f\u4e2d\u6dfb\u52a0\u9002\u5f53\u7684HTML\u951a\u70b9\u4ee3\u7801\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6765\u81ea\u4e00\uff1ahttps:\/\/cloud.tencent.com\/developer\/article\/1429914 &nbsp; \u6765\u81ea\u4e8c\uff1a \u5728WordPress\u4e2d\u94fe\u63a5\u5230\u7279\u5b9a\u7559\u8a00\u7684\u697c\u5c42\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b9e\u73b0\uff1a \u627e\u5230\u7559\u8a00\u7684ID\uff1a \u767b\u5f55\u5230WordP&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[136,135],"tags":[31],"topic":[342],"class_list":["post-5896","post","type-post","status-publish","format-standard","hentry","category-136","category-135","tag-wordpress","topic-wordpress"],"_links":{"self":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/5896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5896"}],"version-history":[{"count":1,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/5896\/revisions"}],"predecessor-version":[{"id":644019,"href":"http:\/\/puo.cn\/index.php?rest_route=\/wp\/v2\/posts\/5896\/revisions\/644019"}],"wp:attachment":[{"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5896"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5896"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/puo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftopic&post=5896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}