{"id":32242,"date":"2024-11-25T11:43:26","date_gmt":"2024-11-25T03:43:26","guid":{"rendered":"https:\/\/fwq.ai\/blog\/32242\/"},"modified":"2024-11-25T11:43:26","modified_gmt":"2024-11-25T03:43:26","slug":"wordpress%e6%80%8e%e4%b9%88%e5%ae%9e%e7%8e%b0%e7%9b%b8%e5%85%b3%e6%96%87%e7%ab%a0%e5%8a%9f%e8%83%bd%ef%bc%9f%e5%87%a0%e7%a7%8d%e6%96%b9%e6%b3%95%e5%88%86%e4%ba%ab","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/32242\/","title":{"rendered":"WordPress\u600e\u4e48\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u529f\u80fd\uff1f\u51e0\u79cd\u65b9\u6cd5\u5206\u4eab"},"content":{"rendered":"<p>\u600e\u4e48\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u529f\u80fd\uff1f\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e0bwordpress\u4ee3\u7801\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u7684\u51e0\u79cd\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/024\/63ff4239cd97a684.jpg\" class=\"aligncenter\" title=\"WordPress\u600e\u4e48\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u529f\u80fd\uff1f\u51e0\u79cd\u65b9\u6cd5\u5206\u4eab\u63d2\u56fe\" alt=\"WordPress\u600e\u4e48\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u529f\u80fd\uff1f\u51e0\u79cd\u65b9\u6cd5\u5206\u4eab\u63d2\u56fe\" \/><\/p>\n<p>WordPress\u5f88\u591a\u63d2\u4ef6\u53ef\u4ee5\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u7684\u529f\u80fd\uff0c\u63d2\u4ef6\u7684\u4f18\u70b9\u662f\u914d\u7f6e\u7b80\u5355\uff0c\u4f46\u662f\u53ef\u80fd\u4f1a\u5bf9\u7f51\u7ad9\u7684\u901f\u5ea6\u9020\u6210\u4e00\u4e9b\u5c0f\u7684\u5f71\u54cd\uff0c\u6240\u4ee5\u5f88\u591a\u4eba\u8fd8\u662f\u6bd4\u8f83\u559c\u6b22\u7528\u4ee3\u7801\u5b9e\u73b0\u9700\u8981\u7684\u529f\u80fd\uff0c\u4f46\u662f\u8bdd\u53c8\u8bf4\u56de\u6765\u4e86\uff0c\u4ee3\u7801\u5b9e\u73b0\u4e5f\u6709\u7f3a\u70b9\uff0c\u5c31\u662f\u914d\u7f6e\u590d\u6742\uff0c\u4e0d\u61c2\u4ee3\u7801\u7684\u4eba\u5b8c\u5168\u6478\u4e0d\u7740\u5934\u8111\u6216\u8005\u53ea\u80fd\u7167\u642c\u522b\u4eba\u7684\u4ee3\u7801\uff0c\u8fd8\u4e0d\u5982\u7528\u63d2\u4ef6\u3002<\/p>\n<p>\u8fd9\u91cc\u6211\u6574\u7406\u7f16\u5199\u4e86\u51e0\u79cd\u7528\u4ee3\u7801\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u7684\u65b9\u6cd5\uff0c\u8fd9\u5176\u4e2d\u4f1a\u8be6\u7ec6\u6807\u660e\u5404\u90e8\u5206\u4ee3\u7801\u7684\u4f5c\u7528\uff0c\u4ee5\u53ca\u5982\u4f55\u81ea\u5b9a\u4e49\u4f60\u60f3\u8981\u7684\u529f\u80fd\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf4\u660e\u4e00\u70b9\uff0c\u4ee5\u4e0b\u6240\u6709\u65b9\u6cd5\u8f93\u51fa\u7684HTML\u4ee3\u7801\u683c\u5f0f\u90fd\u662f\u4ee5\u4e0b\u5f62\u5f0f\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u4fee\u6539\uff1a<\/p>\n<pre><\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n  &nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n<li>*&nbsp; <\/li>\n<p> &nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n<li>*&nbsp; <\/li>\n<p> &nbsp;&nbsp;&nbsp;&nbsp;&#8230;&#8230;\n<\/ul>\n<h3><strong>\u65b9\u6cd5\u4e00\uff1a\u6807\u7b7e\u76f8\u5173<\/strong><\/h3>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u9996\u5148\u83b7\u53d6\u6587\u7ae0\u7684\u6240\u6709\u6807\u7b7e\uff0c\u63a5\u7740\u83b7\u53d6\u8fd9\u4e9b\u6807\u7b7e\u4e0b\u7684 n \u7bc7\u6587\u7ae0\uff0c\u90a3\u4e48\u8fd9 n \u7bc7\u6587\u7ae0\u5c31\u662f\u4e0e\u8be5\u6587\u7ae0\u76f8\u5173\u7684\u6587\u7ae0\u4e86\u3002\u73b0\u5728\u53ef\u4ee5\u89c1\u5230\u7684WordPress\u76f8\u5173\u6587\u7ae0\u63d2\u4ef6\u90fd\u662f\u4f7f\u7528\u7684\u8fd9\u4e2a\u65b9\u6cd5\u3002\u4e0b\u9762\u662f\u5b9e\u73b0\u7684\u4ee3\u7801\uff1a<\/p>\n<pre><\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n  ID); if&nbsp;($post_tags)&nbsp;{ &nbsp;&nbsp;foreach&nbsp;($post_tags&nbsp;as&nbsp;$tag)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u83b7\u53d6\u6807\u7b7e\u5217\u8868 &nbsp;&nbsp;&nbsp;&nbsp;$tag_list[]&nbsp;.=&nbsp;$tag-&gt;term_id; &nbsp;&nbsp;} &nbsp;&nbsp;\/\/&nbsp;\u968f\u673a\u83b7\u53d6\u6807\u7b7e\u5217\u8868\u4e2d\u7684\u4e00\u4e2a\u6807\u7b7e &nbsp;&nbsp;$post_tag&nbsp;=&nbsp;$tag_list[&nbsp;mt_rand(0,&nbsp;count($tag_list)&nbsp;&#8211;&nbsp;1)&nbsp;]; &nbsp;&nbsp;\/\/&nbsp;\u8be5\u65b9\u6cd5\u4f7f\u7528&nbsp;query_posts()&nbsp;\u51fd\u6570\u6765\u8c03\u7528\u76f8\u5173\u6587\u7ae0\uff0c\u4ee5\u4e0b\u662f\u53c2\u6570\u5217\u8868 &nbsp;&nbsp;$args&nbsp;=&nbsp;array( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;tag__in&#8217;&nbsp;=&gt;&nbsp;array($post_tag), &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;category__not_in&#8217;&nbsp;=&gt;&nbsp;array(NULL),&nbsp;&nbsp;\/\/&nbsp;\u4e0d\u5305\u62ec\u7684\u5206\u7c7bID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;post__not_in&#8217;&nbsp;=&gt;&nbsp;array($post-&gt;ID), &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;showposts&#8217;&nbsp;=&gt;&nbsp;6,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u663e\u793a\u76f8\u5173\u6587\u7ae0\u6570\u91cf &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;caller_get_posts&#8217;&nbsp;=&gt;&nbsp;1 &nbsp;&nbsp;&nbsp;&nbsp;); &nbsp;&nbsp;query_posts($args); &nbsp;&nbsp;if&nbsp;(have_posts())&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(have_posts())&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the_post();&nbsp;update_post_caches($posts);&nbsp;?&gt; &nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n<li>*&nbsp; <\/li>\n<p> *&nbsp;\u6682\u65e0\u76f8\u5173\u6587\u7ae0&#8217;; &nbsp;&nbsp;} &nbsp;&nbsp;wp_reset_query();&nbsp; } else&nbsp;{ &nbsp;&nbsp;echo&nbsp;&#8216; <\/p>\n<li>*&nbsp;\u6682\u65e0\u76f8\u5173\u6587\u7ae0<\/li>\n<p>&#8216;; } ?&gt;\n<\/ul>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u4f7f\u7528\u8bf4\u660e\uff1a&#8221;\u4e0d\u5305\u62ec\u7684\u5206\u7c7bID&#8221; \u6307\u7684\u662f\u76f8\u5173\u6587\u7ae0\u4e0d\u663e\u793a\u8be5\u5206\u7c7b\u4e0b\u7684\u6587\u7ae0\uff0c\u5c06\u540c\u884c\u7684 NULL \u6539\u6210\u6587\u7ae0\u5206\u7c7b\u7684ID\u5373\u53ef\uff0c\u591a\u4e2aID\u5c31\u7528\u534a\u89d2\u9017\u53f7\u9694\u5f00\u3002\u56e0\u4e3a\u8fd9\u91cc\u9650\u5236\u53ea\u663e\u793a6\u7bc7\u76f8\u5173\u6587\u7ae0\uff0c\u6240\u4ee5\u4e0d\u7ba1\u7ed9 &nbsp;query_posts() \u7684\u53c2\u6570 tag__in \u8d4b\u591a\u5c11\u4e2a\u503c\uff0c\u90fd\u662f\u53ea\u663e\u793a\u4e00\u4e2a\u6807\u7b7e\u4e0b\u7684 6 \u7bc7\u6587\u7ae0\uff0c\u9664\u975e\u7b2c\u4e00\u4e2a\u6807\u7b7e\u67091\u7bc7\uff0c\u7b2c\u4e8c\u4e2a\u6807\u7b7e\u67092\u7bc7\uff0c\u7b2c\u4e09\u4e2a\u67093\u7bc7\u3002\u3002\u3002\u3002\u3002\u3002\u6240\u4ee5\u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u6709\u591a\u4e2a\u6807\u7b7e\uff0c\u90a3\u4e48\u6211\u4eec\u91c7\u53d6\u7684\u505a\u6cd5\u662f\u968f\u673a\u83b7\u53d6\u4e00\u4e2a\u6807\u7b7e\u7684id\uff0c\u8d4b\u503c\u7ed9 tag__in \u8fd9\u4e2a\u53c2\u6570\uff0c\u83b7\u53d6\u8be5\u6807\u7b7e\u4e0b\u76846\u7bc7\u6587\u7ae0\u3002<\/p>\n<h3><strong>\u65b9\u6cd5\u4e8c\uff1a\u5206\u7c7b\u76f8\u5173<\/strong><\/h3>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u672c\u65b9\u6cd5\u662f\u901a\u8fc7\u83b7\u53d6\u8be5\u6587\u7ae0\u7684\u5206\u7c7bid\uff0c\u7136\u540e\u83b7\u53d6\u8be5\u5206\u7c7b\u4e0b\u7684\u6587\u7ae0\uff0c\u6765\u8fbe\u5230\u83b7\u53d6\u76f8\u5173\u6587\u7ae0\u7684\u76ee\u7684\u3002<\/p>\n<pre><\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n  ID);if&nbsp;($cats)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;$args&nbsp;=&nbsp;array( &nbsp;&nbsp;&#8216;category__in&#8217;&nbsp;=&gt;&nbsp;array(&nbsp;$cats[0]&nbsp;), &nbsp;&nbsp;&#8216;post__not_in&#8217;&nbsp;=&gt;&nbsp;array(&nbsp;$post-&gt;ID&nbsp;), &nbsp;&nbsp;&#8216;showposts&#8217;&nbsp;=&gt;&nbsp;6, &nbsp;&nbsp;&#8216;caller_get_posts&#8217;&nbsp;=&gt;&nbsp;1 &nbsp;&nbsp;); &nbsp;&nbsp;query_posts($args); &nbsp;&nbsp;if&nbsp;(have_posts())&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(have_posts())&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the_post();&nbsp;update_post_caches($posts);&nbsp;?&gt; &nbsp;&nbsp; <\/p>\n<li>*&nbsp; <\/li>\n<p> *&nbsp;\u6682\u65e0\u76f8\u5173\u6587\u7ae0&#8217;; &nbsp;&nbsp;} &nbsp;&nbsp;wp_reset_query();&nbsp;}else&nbsp;{ &nbsp;&nbsp;echo&nbsp;&#8216; <\/p>\n<li>*&nbsp;\u6682\u65e0\u76f8\u5173\u6587\u7ae0<\/li>\n<p>&#8216;;}?&gt;\n<\/ul>\n<h3><strong>\u65b9\u6cd5\u4e09\uff1a\u6807\u7b7e\u76f8\u5173\uff0cSQL\u83b7\u53d6<\/strong><\/h3>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u83b7\u53d6\u76f8\u5173\u6587\u7ae0\u7684\u539f\u7406\u4e0e\u65b9\u6cd5\u4e00\u76f8\u4f3c\uff0c\u4e0d\u8fc7\u5728\u83b7\u53d6\u6587\u7ae0\u7684\u65f6\u5019\u662f\u4ee5SQL\u8bed\u53e5\u6765\u76f4\u63a5\u8bfb\u53d6\u6570\u636e\u5e93\uff0c\u4ece\u800c\u968f\u673a\u83b7\u53d66\u7bc7\u76f8\u5173\u6587\u7ae0\u8bb0\u5f55\uff0c\u800c\u4e0d\u662fWordPress\u7684\u51fd\u6570query_posts().<\/p>\n<pre><\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n  ID);if&nbsp;($post_tags)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;$tag_list&nbsp;=&nbsp;&#8221;; &nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($post_tags&nbsp;as&nbsp;$tag)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u83b7\u53d6\u6807\u7b7e\u5217\u8868 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tag_list&nbsp;.=&nbsp;$tag-&gt;term_id.&#8217;,&#8217;; &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;$tag_list&nbsp;=&nbsp;substr($tag_list,&nbsp;0,&nbsp;strlen($tag_list)-1); &nbsp;&nbsp;&nbsp;&nbsp;$related_posts&nbsp;=&nbsp;$wpdb-&gt;get_results(&#8221; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SELECT&nbsp;DISTINCT&nbsp;ID,&nbsp;post_title &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FROM&nbsp;{$wpdb-&gt;prefix}posts,&nbsp;{$wpdb-&gt;prefix}term_relationships,&nbsp;{$wpdb-&gt;prefix}term_taxonomy &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE&nbsp;{$wpdb-&gt;prefix}term_taxonomy.term_taxonomy_id&nbsp;=&nbsp;{$wpdb-&gt;prefix}term_relationships.term_taxonomy_id &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND&nbsp;ID&nbsp;=&nbsp;object_id &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND&nbsp;taxonomy&nbsp;=&nbsp;&#8216;post_tag&#8217; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND&nbsp;post_status&nbsp;=&nbsp;&#8216;publish&#8217; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND&nbsp;post_type&nbsp;=&nbsp;&#8216;post&#8217; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND&nbsp;term_id&nbsp;IN&nbsp;(&#8221;&nbsp;.&nbsp;$tag_list&nbsp;.&nbsp;&#8220;) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AND&nbsp;ID&nbsp;!=&nbsp;&#8216;&#8221;&nbsp;.&nbsp;$post-&gt;ID&nbsp;.&nbsp;&#8220;&#8216; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ORDER&nbsp;BY&nbsp;RAND() &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LIMIT&nbsp;6&#8221;); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u4ee5\u4e0a\u4ee3\u7801\u4e2d\u7684&nbsp;6&nbsp;\u4e3a\u9650\u5236\u53ea\u83b7\u53d66\u7bc7\u76f8\u5173\u6587\u7ae0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u901a\u8fc7\u4fee\u6539\u6570\u5b57&nbsp;6\uff0c\u53ef\u4fee\u6539\u4f60\u60f3\u8981\u7684\u6587\u7ae0\u6570\u91cf &nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(&nbsp;$related_posts&nbsp;)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;($related_posts&nbsp;as&nbsp;$related_post)&nbsp;{?&gt; &nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n<li><\/li>\n<p> \u6682\u65e0\u76f8\u5173\u6587\u7ae0&#8217;; &nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;}else&nbsp;{ &nbsp;&nbsp;echo&nbsp;&#8216; <\/p>\n<li>\u6682\u65e0\u76f8\u5173\u6587\u7ae0<\/li>\n<p>&#8216;;}?&gt;\n<\/ul>\n<h3><strong>\u65b9\u6cd5\u56db\uff1a\u5206\u7c7b\u76f8\u5173\uff0cSQL\u83b7\u53d6<\/strong><\/h3>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u83b7\u53d6\u76f8\u5173\u6587\u7ae0\u7684\u539f\u7406\u4e0e\u65b9\u6cd5\u4e8c\u76f8\u4f3c\uff0c\u4e0d\u8fc7\u5728\u83b7\u53d6\u6587\u7ae0\u7684\u65f6\u5019\u662f\u4ee5SQL\u8bed\u53e5\u6765\u76f4\u63a5\u8bfb\u53d6\u6570\u636e\u5e93\uff0c\u4ece\u800c\u968f\u673a\u83b7\u53d66\u7bc7\u76f8\u5173\u6587\u7ae0\u8bb0\u5f55\uff0c\u800c\u4e0d\u662fWordPress\u7684\u51fd\u6570query_posts().<\/p>\n<pre><\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n  ID);if&nbsp;($cats)&nbsp;{ &nbsp;&nbsp;$related&nbsp;=&nbsp;$wpdb-&gt;get_results(&#8221; &nbsp;&nbsp;SELECT&nbsp;post_title,&nbsp;ID &nbsp;&nbsp;FROM&nbsp;{$wpdb-&gt;prefix}posts,&nbsp;{$wpdb-&gt;prefix}term_relationships,&nbsp;{$wpdb-&gt;prefix}term_taxonomy &nbsp;&nbsp;WHERE&nbsp;{$wpdb-&gt;prefix}posts.ID&nbsp;=&nbsp;{$wpdb-&gt;prefix}term_relationships.object_id &nbsp;&nbsp;AND&nbsp;{$wpdb-&gt;prefix}term_taxonomy.taxonomy&nbsp;=&nbsp;&#8216;category&#8217; &nbsp;&nbsp;AND&nbsp;{$wpdb-&gt;prefix}term_taxonomy.term_taxonomy_id&nbsp;=&nbsp;{$wpdb-&gt;prefix}term_relationships.term_taxonomy_id &nbsp;&nbsp;AND&nbsp;{$wpdb-&gt;prefix}posts.post_status&nbsp;=&nbsp;&#8216;publish&#8217; &nbsp;&nbsp;AND&nbsp;{$wpdb-&gt;prefix}posts.post_type&nbsp;=&nbsp;&#8216;post&#8217; &nbsp;&nbsp;AND&nbsp;{$wpdb-&gt;prefix}term_taxonomy.term_id&nbsp;=&nbsp;&#8216;&#8221;&nbsp;.&nbsp;$cats[0]&nbsp;.&nbsp;&#8220;&#8216; &nbsp;&nbsp;AND&nbsp;{$wpdb-&gt;prefix}posts.ID&nbsp;!=&nbsp;&#8216;&#8221;&nbsp;.&nbsp;$post-&gt;ID&nbsp;.&nbsp;&#8220;&#8216; &nbsp;&nbsp;ORDER&nbsp;BY&nbsp;RAND(&nbsp;) &nbsp;&nbsp;LIMIT&nbsp;6&#8221;); &nbsp;&nbsp;if&nbsp;(&nbsp;$related&nbsp;)&nbsp;{ &nbsp;&nbsp;foreach&nbsp;($related&nbsp;as&nbsp;$related_post)&nbsp;{?&gt; <\/p>\n<li>*&nbsp; <\/li>\n<p> *&nbsp;\u6682\u65e0\u76f8\u5173\u6587\u7ae0&#8217;; &nbsp;&nbsp;}&nbsp;}else&nbsp;{ &nbsp;&nbsp;echo&nbsp;&#8216; <\/p>\n<li>*&nbsp;\u6682\u65e0\u76f8\u5173\u6587\u7ae0<\/li>\n<p>&#8216;;}?&gt;\n<\/ul>\n<h3><strong>\u65b9\u6cd5\u4e94\uff1a\u4f5c\u8005\u76f8\u5173<\/strong><\/h3>\n<p>\u8be5\u65b9\u6cd5\u662f\u83b7\u53d6\u8be5\u6587\u7ae0\u4f5c\u8005\u7684\u5176\u4ed6\u6587\u7ae0\u6765\u5145\u5f53\u76f8\u5173\u6587\u7ae0\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n  &nbsp;$post_author, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;post__not_in&#8217;&nbsp;=&gt;&nbsp;array($post-&gt;ID), &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;showposts&#8217;&nbsp;=&gt;&nbsp;6, \/\/&nbsp;\u663e\u793a\u76f8\u5173\u6587\u7ae0\u6570\u91cf &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;orderby&#8217;&nbsp;=&gt;&nbsp;date, \/\/&nbsp;\u6309\u65f6\u95f4\u6392\u5e8f &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;caller_get_posts&#8217;&nbsp;=&gt;&nbsp;1 &nbsp;&nbsp;&nbsp;&nbsp;); &nbsp;&nbsp;query_posts($args); &nbsp;&nbsp;if&nbsp;(have_posts())&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(have_posts())&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the_post();&nbsp;update_post_caches($posts);&nbsp;?&gt; &nbsp;&nbsp; <\/p>\n<li>*&nbsp; <\/li>\n<p> *&nbsp;\u6682\u65e0\u76f8\u5173\u6587\u7ae0&#8217;; &nbsp;&nbsp;} &nbsp;&nbsp;wp_reset_query();?&gt;\n<\/ul>\n<h3><strong>\u65f6\u95f4\u6548\u7387\u5bf9\u6bd4<\/strong><\/h3>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u6211\u4eec\u5bf9\u4ee5\u4e0a\u5404\u4e2a\u76f8\u5173\u6587\u7ae0\u4ee3\u7801\u6267\u884c\u65f6\u95f4\u8fdb\u884c\u6d4b\u7b97\uff0c\u4ee5\u4fbf\u5bf9\u4ee5\u4e0a\u5404\u4e2a\u7684\u65b9\u6cd5\u8fdb\u884c\u6548\u7387\uff0c\u7ed9\u4f60\u7684\u9009\u62e9\u63d0\u4f9b\u53c2\u8003\u3002\u4ee5\u4e0b\u662f\u5728\u540c\u4e00\u7bc7\u6587\u7ae0\u4e2d\u83b7\u53d66\u7bc7\u76f8\u5173\u6587\u7ae0\uff0c\u4ee5\u4e0a\u5404\u65b9\u6cd5\u6700\u7ec8\u6d4b\u7b97\u7684\u65f6\u95f4\u5982\u4e0b\uff1a<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u65b9\u6cd5\u4e00\uff1a0.18067908287048 &nbsp;\u79d2<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u65b9\u6cd5\u4e8c\uff1a0.057158946990967 \u79d2<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u65b9\u6cd5\u4e09\uff1a0.037126064300537 \u79d2<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u65b9\u6cd5\u56db\uff1a0.045628070831299 \u79d2<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u65b9\u6cd5\u4e94\uff1a0.023991823196411 \u79d2<\/p>\n<p>\u63a8\u8350\u5b66\u4e60\uff1a\u300a\u300b<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fWordPress\u600e\u4e48\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u529f\u80fd\uff1f\u51e0\u79cd\u65b9\u6cd5\u5206\u4eab\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u600e\u4e48\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u529f\u80fd\uff1f\u4e0b\u9762\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e00\u4e0bwordpress\u4ee3\u7801\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u7684\u51e0\u79cd\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\uff01 WordPress\u5f88\u591a\u63d2\u4ef6\u53ef\u4ee5\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u7684\u529f\u80fd\uff0c\u63d2\u4ef6\u7684\u4f18\u70b9\u662f\u914d\u7f6e\u7b80\u5355\uff0c\u4f46\u662f\u53ef\u80fd\u4f1a\u5bf9\u7f51\u7ad9\u7684\u901f\u5ea6\u9020\u6210\u4e00\u4e9b\u5c0f\u7684\u5f71\u54cd\uff0c\u6240\u4ee5\u5f88\u591a\u4eba\u8fd8\u662f\u6bd4\u8f83\u559c\u6b22\u7528\u4ee3\u7801\u5b9e\u73b0\u9700\u8981\u7684\u529f\u80fd\uff0c\u4f46\u662f\u8bdd\u53c8\u8bf4\u56de\u6765\u4e86\uff0c\u4ee3\u7801\u5b9e\u73b0\u4e5f\u6709\u7f3a\u70b9\uff0c\u5c31\u662f\u914d\u7f6e\u590d\u6742\uff0c\u4e0d\u61c2\u4ee3\u7801\u7684\u4eba\u5b8c\u5168\u6478\u4e0d\u7740\u5934\u8111\u6216\u8005\u53ea\u80fd\u7167\u642c\u522b\u4eba\u7684\u4ee3\u7801\uff0c\u8fd8\u4e0d\u5982\u7528\u63d2\u4ef6\u3002 \u8fd9\u91cc\u6211\u6574\u7406\u7f16\u5199\u4e86\u51e0\u79cd\u7528\u4ee3\u7801\u5b9e\u73b0\u76f8\u5173\u6587\u7ae0\u7684\u65b9\u6cd5\uff0c\u8fd9\u5176\u4e2d\u4f1a\u8be6\u7ec6\u6807\u660e\u5404\u90e8\u5206\u4ee3\u7801\u7684\u4f5c\u7528\uff0c\u4ee5\u53ca\u5982\u4f55\u81ea\u5b9a\u4e49\u4f60\u60f3\u8981\u7684\u529f\u80fd\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf4\u660e\u4e00\u70b9\uff0c\u4ee5\u4e0b\u6240\u6709\u65b9\u6cd5\u8f93\u51fa\u7684HTML\u4ee3\u7801\u683c\u5f0f\u90fd\u662f\u4ee5\u4e0b\u5f62\u5f0f\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u4fee\u6539\uff1a \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 &nbsp;&nbsp;&nbsp;&nbsp; *&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; *&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&#8230;&#8230; \u65b9\u6cd5\u4e00\uff1a\u6807\u7b7e\u76f8\u5173 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u9996\u5148\u83b7\u53d6\u6587\u7ae0\u7684\u6240\u6709\u6807\u7b7e\uff0c\u63a5\u7740\u83b7\u53d6\u8fd9\u4e9b\u6807\u7b7e\u4e0b\u7684 n \u7bc7\u6587\u7ae0\uff0c\u90a3\u4e48\u8fd9 n \u7bc7\u6587\u7ae0\u5c31\u662f\u4e0e\u8be5\u6587\u7ae0\u76f8\u5173\u7684\u6587\u7ae0\u4e86\u3002\u73b0\u5728\u53ef\u4ee5\u89c1\u5230\u7684WordPress\u76f8\u5173\u6587\u7ae0\u63d2\u4ef6\u90fd\u662f\u4f7f\u7528\u7684\u8fd9\u4e2a\u65b9\u6cd5\u3002\u4e0b\u9762\u662f\u5b9e\u73b0\u7684\u4ee3\u7801\uff1a \u767b\u5f55\u540e\u590d\u5236 ID); if&nbsp;($post_tags)&nbsp;{ &nbsp;&nbsp;foreach&nbsp;($post_tags&nbsp;as&nbsp;$tag)&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u83b7\u53d6\u6807\u7b7e\u5217\u8868 &nbsp;&nbsp;&nbsp;&nbsp;$tag_list[]&nbsp;.=&nbsp;$tag-&gt;term_id; &nbsp;&nbsp;} &nbsp;&nbsp;\/\/&nbsp;\u968f\u673a\u83b7\u53d6\u6807\u7b7e\u5217\u8868\u4e2d\u7684\u4e00\u4e2a\u6807\u7b7e &nbsp;&nbsp;$post_tag&nbsp;=&nbsp;$tag_list[&nbsp;mt_rand(0,&nbsp;count($tag_list)&nbsp;&#8211;&nbsp;1)&nbsp;]; &nbsp;&nbsp;\/\/&nbsp;\u8be5\u65b9\u6cd5\u4f7f\u7528&nbsp;query_posts()&nbsp;\u51fd\u6570\u6765\u8c03\u7528\u76f8\u5173\u6587\u7ae0\uff0c\u4ee5\u4e0b\u662f\u53c2\u6570\u5217\u8868 &nbsp;&nbsp;$args&nbsp;=&nbsp;array( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;tag__in&#8217;&nbsp;=&gt;&nbsp;array($post_tag), &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;category__not_in&#8217;&nbsp;=&gt;&nbsp;array(NULL),&nbsp;&nbsp;\/\/&nbsp;\u4e0d\u5305\u62ec\u7684\u5206\u7c7bID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;post__not_in&#8217;&nbsp;=&gt;&nbsp;array($post-&gt;ID), &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;showposts&#8217;&nbsp;=&gt;&nbsp;6,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/&nbsp;\u663e\u793a\u76f8\u5173\u6587\u7ae0\u6570\u91cf &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;caller_get_posts&#8217;&nbsp;=&gt;&nbsp;1 &nbsp;&nbsp;&nbsp;&nbsp;); &nbsp;&nbsp;query_posts($args); &nbsp;&nbsp;if&nbsp;(have_posts())&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(have_posts())&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the_post();&nbsp;update_post_caches($posts);&nbsp;?&gt; &nbsp;&nbsp;&nbsp;&nbsp; *&nbsp; *&nbsp;\u6682\u65e0\u76f8\u5173\u6587\u7ae0&#8217;; &nbsp;&nbsp;} &nbsp;&nbsp;wp_reset_query();&nbsp; } else&nbsp;{ &nbsp;&nbsp;echo&nbsp;&#8216; *&nbsp;\u6682\u65e0\u76f8\u5173\u6587\u7ae0 &#8216;; } ?&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u4f7f\u7528\u8bf4\u660e\uff1a&#8221;\u4e0d\u5305\u62ec\u7684\u5206\u7c7bID&#8221; \u6307\u7684\u662f\u76f8\u5173\u6587\u7ae0\u4e0d\u663e\u793a\u8be5\u5206\u7c7b\u4e0b\u7684\u6587\u7ae0\uff0c\u5c06\u540c\u884c\u7684 NULL [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-32242","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=32242"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32242\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=32242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=32242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=32242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}