{"id":4809,"date":"2025-10-23T17:27:22","date_gmt":"2025-10-23T09:27:22","guid":{"rendered":"https:\/\/www.zhaozhao123.cn\/wpcms\/?p=4809"},"modified":"2025-10-23T17:27:22","modified_gmt":"2025-10-23T09:27:22","slug":"wordpress%e4%b8%ba%e7%94%a8%e6%88%b7%e6%b7%bb%e5%8a%a0%e8%87%aa%e5%ae%9a%e4%b9%89%e5%a4%b4%e5%83%8f%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.zhaozhao123.cn\/wpcms\/post\/4809.html","title":{"rendered":"WordPress\u4e3a\u7528\u6237\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5934\u50cf\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u901a\u8fc7\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5b57\u6bb5\u6765\u5b9e\u73b0 WordPress \u7528\u6237\u81ea\u5b9a\u4e49\u5934\u50cf\u529f\u80fd\u662f<strong>\u5b8c\u5168\u53ef\u4ee5\u7684<\/strong>\uff0c\u8fd9\u662f\u4e00\u79cd\u5e38\u89c1\u4e14\u7075\u6d3b\u7684\u65b9\u6cd5\u3002\u4e0b\u9762\u6211\u5c06\u4e3a\u4f60\u68b3\u7406\u5982\u4f55\u64cd\u4f5c\uff0c\u4ee5\u53ca\u9700\u8981\u6ce8\u610f\u4e9b\u4ec0\u4e48\u3002<\/p><p>\u662f\u7684\uff0c\u901a\u8fc7\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5b57\u6bb5\uff08Custom Field\uff09\u6765\u5b58\u50a8\u7528\u6237\u81ea\u5b9a\u4e49\u5934\u50cf\u7684\u4fe1\u606f\uff0c\u662f\u4e00\u79cd\u76f4\u63a5\u4e14\u6709\u6548\u7684\u65b9\u5f0f\u3002\u8fd9\u901a\u5e38\u610f\u5473\u7740\u4f60\u5c06\u7528\u6237\u4e0a\u4f20\u7684\u5934\u50cf\u56fe\u7247URL\uff08\u6216\u9644\u4ef6ID\uff09\u4f5c\u4e3a\u4e00\u4e2a\u7279\u5b9a\u7684\u503c\uff0c\u4fdd\u5b58\u5728\u7528\u6237\u7684\u5143\u6570\u636e\uff08user meta\uff09\u4e2d\u3002<\/p><h3 class=\"wp-block-heading\">\ud83d\uddbc\ufe0f \u5b9e\u73b0\u601d\u8def\u6982\u8ff0<\/h3><p>\u7b80\u5355\u6765\u8bf4\uff0c\u6574\u4e2a\u8fc7\u7a0b\u53ef\u4ee5\u5206\u4e3a\u4e09\u4e2a\u4e3b\u8981\u6b65\u9aa4\uff1a<\/p><ol class=\"wp-block-list\">\n<li><strong>\u524d\u7aef\u754c\u9762<\/strong>\uff1a\u5728\u7528\u6237\u4e2a\u4eba\u8d44\u6599\u9875\u9762\u63d0\u4f9b\u4e00\u4e2a\u56fe\u7247\u4e0a\u4f20\u8868\u5355\u3002<\/li>\n\n\n\n<li><strong>\u5904\u7406\u4e0a\u4f20<\/strong>\uff1a\u5f53\u7528\u6237\u9009\u62e9\u56fe\u7247\u5e76\u63d0\u4ea4\u540e\uff0c\u5904\u7406\u56fe\u7247\u4e0a\u4f20\u5230\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u5176\u4fdd\u5b58\uff08\u6216\u5173\u8054\uff09\u5230\u5bf9\u5e94\u7528\u6237\u7684\u81ea\u5b9a\u4e49\u5b57\u6bb5\u4e2d\u3002<\/li>\n\n\n\n<li><strong>\u8c03\u7528\u663e\u793a<\/strong>\uff1a\u5728\u9700\u8981\u663e\u793a\u5934\u50cf\u7684\u5730\u65b9\uff0c\u8bfb\u53d6\u8be5\u81ea\u5b9a\u4e49\u5b57\u6bb5\u7684\u503c\u5e76\u8f93\u51fa\u56fe\u7247\u3002<\/li>\n<\/ol><p>\u4e3a\u4e86\u8ba9\u4f60\u66f4\u76f4\u89c2\u5730\u7406\u89e3\u8fd9\u4e2a\u6d41\u7a0b\uff0c\u53ef\u4ee5\u53c2\u8003\u4e0b\u9762\u7684\u5e8f\u5217\u56fe\uff1a<\/p><pre class=\"wp-block-code\"><code>sequenceDiagram\n    participant User as \u7528\u6237\n    participant Front as \u7f51\u7ad9\u524d\u7aef\n    participant Server as \u670d\u52a1\u5668\u5904\u7406\u903b\u8f91 (functions.php)\n    participant DB as \u6570\u636e\u5e93(User Meta)\n\n    User-&gt;&gt;Front: \u8bbf\u95ee\u4e2a\u4eba\u8d44\u6599\u9875\n    Front-&gt;&gt;User: \u663e\u793a\u5934\u50cf\u4e0a\u4f20\u8868\u5355\n    User-&gt;&gt;Front: \u9009\u62e9\u56fe\u7247\u5e76\u63d0\u4ea4\n    Front-&gt;&gt;Server: \u53d1\u9001\u56fe\u7247\u6570\u636e(POST)\n\n    Note over Server: \u9a8c\u8bc1\u6587\u4ef6\u7c7b\u578b\/\u5927\u5c0f&lt;br\/&gt;\u9632\u6b62\u975e\u6cd5\u4e0a\u4f20\n    Server-&gt;&gt;Server: \u5904\u7406\u56fe\u7247\u4e0a\u4f20&lt;br\/&gt;\u79fb\u52a8\u81f3\u5b89\u5168\u76ee\u5f55\n    Server-&gt;&gt;DB: \u5c06\u56fe\u7247\u8def\u5f84\u4fdd\u5b58\u81f3&lt;br\/&gt;\u7528\u6237\u7684\u81ea\u5b9a\u4e49\u5b57\u6bb5\n    Server-&gt;&gt;Front: \u8fd4\u56de\u4e0a\u4f20\u6210\u529f\/\u5931\u8d25\u6d88\u606f\n    Front-&gt;&gt;User: \u663e\u793a\u64cd\u4f5c\u7ed3\u679c\n\n    Note over User, DB: \u663e\u793a\u5934\u50cf\u65f6\n    Front-&gt;&gt;DB: \u67e5\u8be2\u8be5\u7528\u6237\u7684&lt;br\/&gt;\u81ea\u5b9a\u4e49\u5934\u50cf\u5b57\u6bb5\n    DB-&gt;&gt;Front: \u8fd4\u56de\u5934\u50cf\u56fe\u7247\u8def\u5f84\n    Front-&gt;&gt;User: \u5728\u9875\u9762\u4e2d\u663e\u793a\u81ea\u5b9a\u4e49\u5934\u50cf<\/code><\/pre><h3 class=\"wp-block-heading\">\u2699\ufe0f \u4e3b\u8981\u5b9e\u73b0\u6b65\u9aa4<\/h3><p>\u4e0b\u9762\u662f\u57fa\u4e8e\u4e0a\u8ff0\u6d41\u7a0b\u7684\u5173\u952e\u4ee3\u7801\u5b9e\u73b0\u73af\u8282\uff1a<\/p><h4 class=\"wp-block-heading\">1. \u521b\u5efa\u524d\u7aef\u4e0a\u4f20\u8868\u5355<\/h4><p>\u4f60\u9700\u8981\u5728\u4f60\u4e3b\u9898\u7684\u7528\u6237\u4e2a\u4eba\u8d44\u6599\u9875\u9762\uff08\u4f8b\u5982 <code>user-profile.php<\/code> \u6216\u524d\u7aef\u7528\u6237\u4e2d\u5fc3\u9875\u9762\u6a21\u677f\uff09\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u8868\u5355\u3002<strong>\u5207\u8bb0<\/strong>\u8868\u5355\u5fc5\u987b\u8bbe\u7f6e <code>enctype=\"multipart\/form-data\"<\/code>\uff0c\u5426\u5219\u6587\u4ef6\u65e0\u6cd5\u4e0a\u4f20\u3002<\/p><pre class=\"wp-block-code\"><code>&lt;form action=\"\" method=\"post\" enctype=\"multipart\/form-data\"&gt;\n    &lt;label for=\"simple_local_avatar\"&gt;\u4e0a\u4f20\u81ea\u5b9a\u4e49\u5934\u50cf:&lt;\/label&gt;\n    &lt;input type=\"file\" name=\"simple_local_avatar\" id=\"simple_local_avatar\" accept=\"image\/jpeg, image\/png, image\/gif\"&gt;\n    &lt;input type=\"submit\" name=\"submit_avatar\" value=\"\u4e0a\u4f20\u5934\u50cf\"&gt;\n    &lt;!-- \u522b\u5fd8\u4e86\u6dfb\u52a0\u5b89\u5168\u6027\u7684 nonce \u5b57\u6bb5 --&gt;\n    &lt;?php wp_nonce_field('avatar_upload_nonce_action', 'avatar_upload_nonce'); ?&gt;\n&lt;\/form&gt;<\/code><\/pre><h4 class=\"wp-block-heading\">2. \u5904\u7406\u56fe\u7247\u4e0a\u4f20\u5e76\u4fdd\u5b58\u5230\u81ea\u5b9a\u4e49\u5b57\u6bb5<\/h4><p>\u8fd9\u90e8\u5206\u4ee3\u7801\u901a\u5e38\u653e\u5728\u4e3b\u9898\u7684 <code>functions.php<\/code> \u6587\u4ef6\u4e2d\u3002\u5b83\u8d1f\u8d23\u63a5\u6536\u524d\u7aef\u4e0a\u4f20\u7684\u56fe\u7247\uff0c\u8fdb\u884c\u5b89\u5168\u5904\u7406\uff0c\u5e76\u5c06\u5176\u8def\u5f84\u4fdd\u5b58\u4e3a\u7528\u6237\u5143\u6570\u636e\u3002<\/p><pre class=\"wp-block-code\"><code>\/\/ \u6302\u94a9\u5230 init \u6216 admin_post \u6765\u5904\u7406\u524d\u7aef\u4e0a\u4f20\nadd_action('template_redirect', 'handle_custom_avatar_upload');\nfunction handle_custom_avatar_upload() {\n    if (isset($_POST['submit_avatar']) &amp;&amp; wp_verify_nonce($_POST['avatar_upload_nonce'], 'avatar_upload_nonce_action')) {\n        $current_user_id = get_current_user_id();\n        if (!$current_user_id) {\n            wp_die('\u8bf7\u5148\u767b\u5f55\uff01');\n        }\n\n        \/\/ \u68c0\u67e5\u6587\u4ef6\u662f\u5426\u4e0a\u4f20\u6210\u529f\n        if (!empty($_FILES['simple_local_avatar']['tmp_name'])) {\n            require_once(ABSPATH . 'wp-admin\/includes\/file.php');\n            require_once(ABSPATH . 'wp-admin\/includes\/image.php');\n\n            $override = array('test_form' =&gt; false);\n            $uploaded_file = wp_handle_upload($_FILES['simple_local_avatar'], $override);\n\n            if (isset($uploaded_file['url'])) {\n                \/\/ \u5c06\u56fe\u7247URL\u4fdd\u5b58\u4e3a\u7528\u6237\u5143\u6570\u636e\n                update_user_meta($current_user_id, 'simple_local_avatar', $uploaded_file['url']);\n                \/\/ \u53ef\u4ee5\u8bbe\u7f6e\u6210\u529f\u6d88\u606f\n            } else {\n                \/\/ \u5904\u7406\u4e0a\u4f20\u9519\u8bef\n            }\n        }\n    }\n}<\/code><\/pre><p><em>\u4ee5\u4e0a\u4ee3\u7801\u662f\u4e00\u4e2a\u7b80\u5316\u793a\u4f8b\uff0c\u5f3a\u8c03\u4e86\u6838\u5fc3\u903b\u8f91\u3002\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u4f60\u9700\u8981\u6dfb\u52a0\u66f4\u5b8c\u5584\u7684\u9519\u8bef\u5904\u7406\u3001\u6587\u4ef6\u7c7b\u578b\u548c\u5927\u5c0f\u68c0\u67e5\u3001\u4ee5\u53ca\u53ef\u80fd\u7684\u56fe\u7247\u538b\u7f29\u7b49\u529f\u80fd\u3002<\/em><\/p><h4 class=\"wp-block-heading\">3. \u8c03\u7528\u548c\u663e\u793a\u81ea\u5b9a\u4e49\u5934\u50cf<\/h4><p>\u4e4b\u540e\uff0c\u5728\u9700\u8981\u663e\u793a\u7528\u6237\u5934\u50cf\u7684\u5730\u65b9\uff08\u5982\u8bc4\u8bba\u5217\u8868\u3001\u4f5c\u8005\u6846\u7b49\uff09\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u83b7\u53d6\u8be5\u7528\u6237\u7684\u81ea\u5b9a\u4e49\u5b57\u6bb5\u503c\u6765\u8f93\u51fa\u5934\u50cf\u3002<\/p><pre class=\"wp-block-code\"><code>$user_id = get_the_author_meta('ID'); \/\/ \u6216\u5728\u5faa\u73af\u5916\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\u83b7\u53d6\u7528\u6237ID\n$custom_avatar_url = get_user_meta($user_id, 'simple_local_avatar', true);\n\nif (!empty($custom_avatar_url)) {\n    echo '&lt;img src=\"' . esc_url($custom_avatar_url) . '\" alt=\"\u81ea\u5b9a\u4e49\u5934\u50cf\" width=\"100\" height=\"100\"&gt;';\n} else {\n    \/\/ \u5982\u679c\u7528\u6237\u6ca1\u6709\u4e0a\u4f20\u81ea\u5b9a\u4e49\u5934\u50cf\uff0c\u53ef\u4ee5\u56de\u9000\u5230\u663e\u793aGravatar\u6216\u9ed8\u8ba4\u5934\u50cf\n    echo get_avatar($user_id, 100);\n}<\/code><\/pre><h3 class=\"wp-block-heading\">\u26a0\ufe0f \u6ce8\u610f\u4e8b\u9879\u548c\u8fdb\u9636\u601d\u8003<\/h3><p>\u5b9e\u73b0\u57fa\u7840\u529f\u80fd\u4e0d\u96be\uff0c\u4f46\u8981\u505a\u5f97\u7a33\u5065\u3001\u5b89\u5168\u3001\u597d\u7528\uff0c\u8fd8\u9700\u8981\u8003\u8651\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p><ul class=\"wp-block-list\">\n<li><strong>\u5b89\u5168\u6027\u81f3\u5173\u91cd\u8981<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li><strong>\u6743\u9650\u68c0\u67e5<\/strong>\uff1a\u786e\u4fdd\u53ea\u6709\u767b\u5f55\u7528\u6237\u624d\u80fd\u4e0a\u4f20\uff0c\u5e76\u4e14\u53ea\u80fd\u4fee\u6539\u81ea\u5df1\u7684\u5934\u50cf\uff08\u7ba1\u7406\u5458\u53ef\u4ee5\u4f8b\u5916\uff09\u3002<\/li>\n\n\n\n<li><strong>Nonce \u9a8c\u8bc1<\/strong>\uff1a\u4f7f\u7528 WordPress nonce \u9632\u6b62\u8de8\u7ad9\u8bf7\u6c42\u4f2a\u9020\uff08CSRF\uff09\u653b\u51fb\u3002<\/li>\n\n\n\n<li><strong>\u6587\u4ef6\u9a8c\u8bc1<\/strong>\uff1a\u4e25\u683c\u68c0\u67e5\u4e0a\u4f20\u6587\u4ef6\u7684<strong>\u7c7b\u578b<\/strong>\uff08MIME\u7c7b\u578b\uff09\u3001<strong>\u540e\u7f00\u540d<\/strong>\u548c<strong>\u5927\u5c0f<\/strong>\uff0c\u9632\u6b62\u4e0a\u4f20\u6076\u610f\u6587\u4ef6\u3002<code>wp_handle_upload<\/code> \u51fd\u6570\u53ef\u4ee5\u5e2e\u52a9\u5b8c\u6210\u90e8\u5206\u5de5\u4f5c\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u4e0e\u73b0\u6709\u7cfb\u7edf\u878d\u5408\uff08\u53ef\u9009\u4f46\u63a8\u8350\uff09<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li>\u4e3a\u4e86\u8ba9\u4f60\u7684\u81ea\u5b9a\u4e49\u5934\u50cf\u80fd\u88ab WordPress \u6807\u51c6\u7684 <code>get_avatar<\/code> \u51fd\u6570\u8bc6\u522b\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 <code>pre_get_avatar_data<\/code> \u8fc7\u6ee4\u5668\u3002\u8fd9\u5141\u8bb8\u4f60\u5728\u5934\u50cf\u6570\u636e\u88ab\u83b7\u53d6\u524d\uff0c\u7528\u4f60\u7684\u81ea\u5b9a\u4e49\u5934\u50cfURL\u66ff\u6362\u9ed8\u8ba4\u7684Gravatar URL\u3002<br><code>php add_filter('pre_get_avatar_data', function($args, $id_or_email) { \/\/ \u5c1d\u8bd5\u4ece $id_or_email \u53c2\u6570\u4e2d\u83b7\u53d6\u7528\u6237ID $user_id = ...; \/\/ \u9700\u8981\u7f16\u5199\u903b\u8f91\u6765\u89e3\u6790$id_or_email\uff08\u53ef\u4ee5\u662fID\u3001\u90ae\u7bb1\u3001\u8bc4\u8bba\u5bf9\u8c61\u7b49\uff09 $custom_avatar = get_user_meta($user_id, 'simple_local_avatar', true); if (!empty($custom_avatar)) { $args['url'] = $custom_avatar; \/\/ \u66ff\u6362\u5934\u50cfURL \/\/ \u53ef\u80fd\u8fd8\u9700\u8981\u8bbe\u7f6e $args['found_avatar'] = true; } return $args; }, 10, 2);<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u7528\u6237\u4f53\u9a8c\u63d0\u5347<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li><strong>\u524d\u7aef\u88c1\u526a<\/strong>\uff1a\u5141\u8bb8\u7528\u6237\u5728\u4e0a\u4f20\u524d\u88c1\u526a\u56fe\u7247\uff0c\u4ee5\u4fdd\u8bc1\u5934\u50cf\u6bd4\u4f8b\u4e00\u81f4\uff0c\u63d0\u5347\u7f8e\u89c2\u5ea6\u3002\u8fd9\u901a\u5e38\u9700\u8981\u5f15\u5165\u5982 <strong>Jcrop<\/strong> \u7b49 JavaScript \u5e93\u3002<\/li>\n\n\n\n<li><strong>\u53cd\u9988\u6d88\u606f<\/strong>\uff1a\u4e3a\u7528\u6237\u63d0\u4f9b\u6e05\u6670\u7684\u4e0a\u4f20\u6210\u529f\u6216\u5931\u8d25\u7684\u6d88\u606f\u63d0\u793a\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u6027\u80fd\u548c\u7ba1\u7406<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li><strong>\u6587\u4ef6\u7ba1\u7406<\/strong>\uff1a\u8003\u8651\u7528\u6237\u91cd\u590d\u4e0a\u4f20\u65f6\uff0c<strong>\u5220\u9664\u65e7\u7684\u5e9f\u5f03\u5934\u50cf\u56fe\u7247<\/strong>\uff0c\u907f\u514d\u5360\u7528\u4e0d\u5fc5\u8981\u7684\u670d\u52a1\u5668\u7a7a\u95f4\u3002\u8fd9\u9700\u8981\u5728\u4e0a\u4f20\u65b0\u5934\u50cf\u540e\uff0c\u5220\u9664\u65e7\u5934\u50cf\u6587\u4ef6\u3002<\/li>\n\n\n\n<li><strong>\u56fe\u7247\u5c3a\u5bf8<\/strong>\uff1a\u6839\u636e\u7f51\u7edc\u73af\u5883\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u751f\u6210\u4e0d\u540c\u5c3a\u5bf8\u7684\u5934\u50cf\u7f29\u7565\u56fe\uff08\u5982 100&#215;100, 50&#215;50\uff09\uff0c\u4ee5\u9002\u5e94\u4e0d\u540c\u573a\u666f\u5e76\u63d0\u9ad8\u52a0\u8f7d\u901f\u5ea6\u3002\u8fd9\u53ef\u4ee5\u4f7f\u7528 <code>wp_get_image_editor<\/code> \u51fd\u6570\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul><h3 class=\"wp-block-heading\">\ud83d\udca1 \u66ff\u4ee3\u65b9\u6848\uff1a\u4f7f\u7528\u73b0\u6210\u63d2\u4ef6<\/h3><p>\u5982\u679c\u4f60\u89c9\u5f97\u624b\u52a8\u5b9e\u73b0\u6bd4\u8f83\u7e41\u7410\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u4e00\u4e9b\u4e13\u95e8\u4e3a\u6b64\u8bbe\u8ba1\u7684\u63d2\u4ef6\uff0c\u5b83\u4eec\u901a\u5e38\u63d0\u4f9b\u4e86\u66f4\u5b8c\u5584\u7684\u529f\u80fd\u548c\u7528\u6237\u754c\u9762\uff1a<\/p><ul class=\"wp-block-list\">\n<li><strong>Simple Local Avatars<\/strong>\uff1a\u8fd9\u6b3e\u63d2\u4ef6\u8f7b\u91cf\u4e14\u6d41\u884c\uff0c\u76f4\u63a5\u5728\u7528\u6237\u8d44\u6599\u7f16\u8f91\u9875\u9762\u6dfb\u52a0\u4e86\u4e00\u4e2a\u4e0a\u4f20\u5b57\u6bb5\uff0c\u5e76\u901a\u5e38\u652f\u6301\u4e0e <code>get_avatar<\/code> \u96c6\u6210\u3002<\/li>\n\n\n\n<li><strong>WP User Avatar<\/strong>\uff1a\u540c\u6837\u662f\u4e00\u6b3e\u70ed\u95e8\u63d2\u4ef6\uff0c\u63d0\u4f9b\u524d\u7aef\u548c\u540e\u7aef\u7684\u5934\u50cf\u4e0a\u4f20\u529f\u80fd\u3002<\/li>\n<\/ul><p>\u4f7f\u7528\u63d2\u4ef6\u7684\u4f18\u70b9\u662f<strong>\u5feb\u901f\u3001\u65b9\u4fbf<\/strong>\uff0c\u4f46\u7f3a\u70b9\u662f\u591a\u4f9d\u8d56\u4e00\u4e2a\u63d2\u4ef6\uff0c\u53ef\u80fd\u5728\u81ea\u5b9a\u4e49\u7a0b\u5ea6\u4e0a\u4e0d\u5982\u81ea\u5df1\u4ee3\u7801\u5b9e\u73b0\u7075\u6d3b\u3002<\/p><h3 class=\"wp-block-heading\">\ud83d\udc8e \u603b\u7ed3<\/h3><p>\u901a\u8fc7\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5b57\u6bb5\u6765\u5b9e\u73b0 WordPress \u7528\u6237\u81ea\u5b9a\u4e49\u5934\u50cf\u529f\u80fd\u662f<strong>\u5b8c\u5168\u53ef\u884c\u4e14\u5e38\u89c1\u7684\u65b9\u6cd5<\/strong>\u3002\u5b83\u7684<strong>\u6838\u5fc3\u601d\u8def<\/strong>\u662f\u5229\u7528 WordPress \u7684\u7528\u6237\u5143\u6570\u636e\uff08<code>update_user_meta<\/code> \/ <code>get_user_meta<\/code>\uff09\u6765\u5b58\u50a8\u548c\u8bfb\u53d6\u7528\u6237\u4e0a\u4f20\u7684\u5934\u50cf\u56fe\u7247\u8def\u5f84\u3002<\/p><ul class=\"wp-block-list\">\n<li>\u5982\u679c\u4f60\u7684<strong>\u5f00\u53d1\u80fd\u529b\u8f83\u5f3a<\/strong>\uff0c\u5e0c\u671b\u6709<strong>\u5b8c\u5168\u7684\u63a7\u5236\u6743<\/strong>\uff0c\u5e76\u60f3<strong>\u907f\u514d\u5b89\u88c5\u8fc7\u591a\u63d2\u4ef6<\/strong>\uff0c\u90a3\u4e48<strong>\u81ea\u5df1\u7f16\u5199\u4ee3\u7801\u5b9e\u73b0<\/strong>\u662f\u5f88\u597d\u7684\u9009\u62e9\u3002\u8bf7\u52a1\u5fc5\u505a\u597d<strong>\u5b89\u5168\u63aa\u65bd<\/strong>\uff08\u6743\u9650\u3001nonce\u3001\u6587\u4ef6\u9a8c\u8bc1\uff09\u5e76\u8003\u8651\u5982\u4f55\u4e0e\u73b0\u6709\u4e3b\u9898\u878d\u5408\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u4f60\u5e0c\u671b<strong>\u5feb\u901f\u4e0a\u7ebf<\/strong>\u3001<strong>\u8ffd\u6c42\u7a33\u5b9a<\/strong>\u4e14\u4e0d\u9700\u8981\u6df1\u5ea6\u5b9a\u5236\uff0c\u90a3\u4e48\u5148\u4ece\u4e00\u6b3e\u50cf <strong>Simple Local Avatars<\/strong> \u8fd9\u6837\u7684<strong>\u63d2\u4ef6<\/strong>\u5f00\u59cb\u5c1d\u8bd5\uff0c\u53ef\u80fd\u66f4\u7701\u5fc3\u7701\u529b\u3002<\/li>\n<\/ul><p>\u65e0\u8bba\u9009\u62e9\u54ea\u79cd\u65b9\u5f0f\uff0c\u90fd\u80fd\u6709\u6548\u5730\u8ba9\u7528\u6237\u6446\u8131\u5bf9 Gravatar \u7684\u4f9d\u8d56\uff0c\u63d0\u5347\u7f51\u7ad9\u7684\u7528\u6237\u4f53\u9a8c\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u901a\u8fc7\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5b57\u6bb5\u6765\u5b9e\u73b0 WordPress \u7528\u6237\u81ea\u5b9a\u4e49\u5934\u50cf\u529f\u80fd\u662f\u5b8c\u5168\u53ef\u4ee5\u7684\uff0c\u8fd9\u662f\u4e00\u79cd\u5e38\u89c1\u4e14\u7075\u6d3b\u7684\u65b9\u6cd5\u3002\u4e0b\u9762\u6211\u5c06\u4e3a\u4f60\u68b3\u7406\u5982\u4f55\u64cd\u4f5c\uff0c\u4ee5\u53ca\u9700\u8981\u6ce8\u610f\u4e9b\u4ec0\u4e48\u3002 \u662f\u7684\uff0c\u901a\u8fc7\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5b57\u6bb5\uff08Custom Field\uff09\u6765\u5b58\u50a8\u7528\u6237\u81ea\u5b9a\u4e49\u5934\u50cf\u7684\u4fe1\u606f\uff0c\u662f\u4e00\u79cd\u76f4\u63a5\u4e14\u6709\u6548\u7684\u65b9\u5f0f\u3002\u8fd9\u901a\u5e38\u610f\u5473\u7740\u4f60\u5c06\u7528\u6237\u4e0a\u4f20\u7684\u5934\u50cf\u56fe\u7247URL\uff08\u6216\u9644\u4ef6ID\uff09\u4f5c\u4e3a\u4e00\u4e2a\u7279..<\/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":[],"tuisongtax":[],"class_list":["post-4809","post","type-post","status-publish","format-standard","hentry","category-wpdt"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/4809","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=4809"}],"version-history":[{"count":0,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/posts\/4809\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/media?parent=4809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/categories?post=4809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tags?post=4809"},{"taxonomy":"tuisongtax","embeddable":true,"href":"https:\/\/www.zhaozhao123.cn\/wpcms\/wp-json\/wp\/v2\/tuisongtax?post=4809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}