{"id":32613,"date":"2024-11-25T10:07:14","date_gmt":"2024-11-25T02:07:14","guid":{"rendered":"https:\/\/fwq.ai\/blog\/32613\/"},"modified":"2024-11-25T10:07:14","modified_gmt":"2024-11-25T02:07:14","slug":"%e6%9e%84%e5%bb%ba%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84wordpress%e7%94%a8%e6%88%b7%e6%b5%81%e7%a8%8b%ef%bc%8c%e7%ac%ac%e4%b8%89%e9%83%a8%e5%88%86%ef%bc%9a%e5%af%86%e7%a0%81%e9%87%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/32613\/","title":{"rendered":"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e"},"content":{"rendered":"<\/p>\n<p>\u5728\u672c\u7cfb\u5217\u7684\u524d\u4e24\u4e2a\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u6784\u5efa\u4e86\u7528\u4e8e\u767b\u5f55\u548c\u6ce8\u518c\u65b0\u7528\u6237\u7684\u81ea\u5b9a\u4e49\u9875\u9762\u3002\u73b0\u5728\uff0c\u767b\u5f55\u6d41\u7a0b\u4e2d\u53ea\u5269\u4e0b\u4e00\u4e2a\u90e8\u5206\u9700\u8981\u63a2\u7d22\u548c\u66ff\u6362\uff1a\u5982\u679c\u7528\u6237\u5fd8\u8bb0\u5bc6\u7801\u5e76\u60f3\u8981\u91cd\u7f6e  \u5bc6\u7801\uff0c\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<\/p>\n<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u89e3\u51b3\u6700\u540e\u4e00\u6b65\u5e76\u5b8c\u6210\u6211\u4eec\u5728\u6574\u4e2a\u7cfb\u5217\u4e2d\u6784\u5efa\u7684<em>\u4e2a\u6027\u5316\u767b\u5f55<\/em>\u63d2\u4ef6\u3002 <\/p>\n<p>WordPress \u4e2d\u7684\u529f\u80fd\u6216\u591a\u6216\u5c11\u9075\u5faa\u5f53\u4eca\u7f51\u7ad9\u4e0a\u7684\u6807\u51c6\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li>\u7528\u6237\u901a\u8fc7\u8f93\u5165\u7528\u6237\u540d\u6216\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u5e76\u8bf7\u6c42 WordPress \u91cd\u7f6e\u5bc6\u7801\u6765\u542f\u52a8\u91cd\u7f6e\u3002 <\/li>\n<li>\u521b\u5efa\u4e34\u65f6\u5bc6\u7801\u91cd\u7f6e\u4ee4\u724c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u7528\u6237\u6570\u636e\u4e2d\u3002\u5305\u542b\u6b64\u4ee4\u724c\u7684\u94fe\u63a5\u5c06\u53d1\u9001\u5230\u7528\u6237\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002<\/li>\n<li>\u7528\u6237\u70b9\u51fb\u94fe\u63a5\u3002<\/li>\n<li>\u5728\u91cd\u7f6e\u5bc6\u7801\u9875\u9762\u4e0a\uff0c\u4ee4\u724c\u4f1a\u7ecf\u8fc7\u9a8c\u8bc1\uff0c\u5982\u679c\u5b83\u4e0e\u7528\u6237\u7684\u6570\u636e\u5339\u914d\uff0c\u4ed6\u4eec\u5c31\u53ef\u4ee5\u9009\u62e9\u4e00\u4e2a\u65b0\u5bc6\u7801\u3002<\/li>\n<\/ol>\n<p>\u5c31\u50cf\u767b\u5f55\u548c\u65b0\u7528\u6237\u6ce8\u518c\u4e00\u6837\uff0c\u6b64\u529f\u80fd\u662f\u901a\u8fc7 wp-login.php \u5904\u7406\u7684\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u5982\u4f55\u81ea\u5b9a\u4e49\u6b64\u6d41\u7a0b\u7684\u603b\u4f53\u601d\u8def\u73b0\u5728\u5927\u90e8\u5206\u90fd\u662f\u4ee5\u524d\u7684\u6559\u7a0b\u6240\u719f\u6089\u7684\u3002 <\/p>\n<p>\u5982\u679c\u60a8\u5c1a\u672a\u9605\u8bfb\u524d\u4e24\u4e2a\u6559\u7a0b\uff0c\u6700\u597d\u4ece\u7b2c 1 \u90e8\u5206\u5f00\u59cb\u5e76\u6309\u987a\u5e8f\u6d4f\u89c8\u8be5\u7cfb\u5217\u3002\u60a8\u53ef\u4ee5\u6309\u7167\u6559\u7a0b\u81ea\u884c\u7f16\u5199\u4ee3\u7801\uff0c\u4e5f\u53ef\u4ee5\u4ece\u94fe\u63a5\u7684 GitHub \u5b58\u50a8\u5e93\u4e0b\u8f7d\u5b8c\u6574\u7684\u6e90\u4ee3\u7801\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u5f00\u59cb\u66ff\u6362\u6d41\u7a0b\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5c4f\u5e55\u3002<\/p>\n<h2>\u542f\u52a8 WordPress \u91cd\u7f6e\u5bc6\u7801<\/h2>\n<p>\u5f53\u7528\u6237\u5230\u8fbe\u60a8\u7684\u767b\u5f55\u9875\u9762\u4f46\u4e0d\u8bb0\u5f97\u4ed6\u4eec\u5728\u8be5\u7f51\u7ad9\u4e0a\u4f7f\u7528\u7684\u5bc6\u7801\u65f6\uff0c\u5c31\u4f1a\u5f00\u59cb\u91cd\u7f6e WP \u5bc6\u7801\u3002 <\/p>\n<p>\u4e3a\u6b64\uff0c\u6211\u4eec\u5728\u672c\u7cfb\u5217\u7b2c\u4e00\u90e8\u5206\u7684<strong>\u767b\u5f55<\/strong>\u8868\u5355\u5e95\u90e8\u653e\u7f6e\u4e86\u4e00\u4e2a<strong>\u5fd8\u8bb0\u5bc6\u7801\uff1f<\/strong>\u6d88\u606f\u6a21\u677f\u94fe\u63a5\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5728 WordPress \u652f\u6301\u7684\u7f51\u7ad9\u4e0a\uff0c\u6b64\u94fe\u63a5\u6307\u5411 wp-login.php?action=lostpassword\uff0c\u9875\u9762\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/465\/014\/169375350753008.png\" class=\"aligncenter\" title=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe\" alt=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe\" \/><\/p>\n<p>\u8981\u5c06\u6b64\u9875\u9762\u66ff\u6362\u4e3a\u81ea\u5b9a\u4e49\u9875\u9762\uff0c\u6211\u4eec\u5c06\u521b\u5efa\u4e00\u4e2a\u51fd\u6570\u6765\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u6211\u4eec\u7684\u81ea\u5b9a\u4e49\u9875\u9762\uff0c\u5e76\u5c06\u8be5\u51fd\u6570\u6302\u94a9\u5230 WordPress \u64cd\u4f5c\u3002<\/p>\n<p>\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u6709\u4e24\u4e2a\u9009\u9879\u53ef\u4f9b\u9009\u62e9\uff1a\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u64cd\u4f5c lost_password\uff0c\u8be5\u64cd\u4f5c\u5728\u9875\u9762\u6e32\u67d3\u4e4b\u524d\u8c03\u7528\uff0c\u6216\u8005\u6211\u4eec\u5728\u4e4b\u524d\u7684\u6559\u7a0b\u4e2d\u4f7f\u7528\u7684\u64cd\u4f5c\uff1a login_form_{action}\uff0c\u8fd9\u6b21\u662flogin_form_lostpassword\u3002<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u91c7\u53d6\u4e24\u79cd\u65b9\u6cd5\uff0c\u4f46\u4e3a\u4e86\u9650\u5236\u6267\u884c\u7684\u4e0d\u5fc5\u8981\u4ee3\u7801\u7684\u6570\u91cf\uff0c\u8ba9\u6211\u4eec\u9009\u62e9\u540e\u4e00\u4e2a\u9009\u9879\u3002<\/p>\n<p>\u4f46\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u521b\u5efa\u65b0\u7684 WordPress \u81ea\u5b9a\u4e49\u5bc6\u7801\u91cd\u7f6e\u9875\u9762\uff1a<\/p>\n<p><span style=\"font-size:21px;font-weight:bold\">\u7b2c 1 \u6b65\uff1a\u521b\u5efa\u91cd\u7f6e\u5bc6\u7801\u9875\u9762<\/span> p&gt; <\/p>\n<p>\u6b63\u5982\u60a8\u6240\u8bb0\u5f97\u7684\uff0c\u5728\u7b2c 1 \u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 plugin_activated \u56de\u8c03\u51fd\u6570\u521b\u5efa\u4e86\u4e00\u4e2a\u5728\u63d2\u4ef6\u6fc0\u6d3b\u65f6\u521b\u5efa WordPress \u9875\u9762\u7684\u51fd\u6570\u3002<\/p>\n<p>\u5728\u6b64\u51fd\u6570\u4e2d\uff0c\u5c06\u65b0\u9875\u9762\u7684\u5b9a\u4e49\u6dfb\u52a0\u5230 $page_definitions \u6570\u7ec4\u7684\u672b\u5c3e\u3002\u5728 WordPress \u5bc6\u7801\u91cd\u7f6e\u6d41\u7a0b\u4e2d\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u7b2c\u4e8c\u4e2a\u9875\u9762\u6765\u9009\u62e9\u65b0\u5bc6\u7801\u3002\u56e0\u6b64\uff0c\u4e3a\u4e86\u8282\u7701\u65f6\u95f4\uff0c\u6211\u4eec\u73b0\u5728\u8fd8\u6dfb\u52a0\u7b2c\u4e8c\u9875\u3002<\/p>\n<p>\u4e3a\u4e86\u6e05\u695a\u8d77\u89c1\uff0c\u8fd9\u662f\u6574\u4e2a\u6570\u7ec4\uff08\u6dfb\u52a0\u4e86\u6700\u540e\u4e24\u4e2a\u9875\u9762\u5b9a\u4e49\uff09\uff1a<\/p>\n<pre>\/\/ Information needed for creating the plugin's pages\n$page_definitions = array(\n    'member-login' =&amp;gt; array(\n        'title' =&amp;gt; __( 'Sign In', 'personalize-login' ),\n        'content' =&amp;gt; '[custom-login-form]'\n    ),\n    'member-account' =&amp;gt; array(\n        'title' =&amp;gt; __( 'Your Account', 'personalize-login' ),\n        'content' =&amp;gt; '[account-info]'\n    ),\n    'member-register' =&amp;gt; array(\n        'title' =&amp;gt; __( 'Register', 'personalize-login' ),\n        'content' =&amp;gt; '[custom-register-form]'\n    ),\n    'member-password-lost' =&amp;gt; array(\n        'title' =&amp;gt; __( 'Forgot Your Password?', 'personalize-login' ),\n        'content' =&amp;gt; '[custom-password-lost-form]'\n    ),\n    'member-password-reset' =&amp;gt; array(\n        'title' =&amp;gt; __( 'Pick a New Password', 'personalize-login' ),\n        'content' =&amp;gt; '[custom-password-reset-form]'\n    )\n);\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63d2\u4ef6\u6fc0\u6d3b\u56de\u8c03\u4ec5\u5728\u63d2\u4ef6\u88ab\u663e\u5f0f\u6fc0\u6d3b\u65f6\u8c03\u7528\uff0c\u56e0\u6b64\u8981\u521b\u5efa\u8fd9\u4e9b\u65b0\u9875\u9762\uff0c\u60a8\u5fc5\u987b\u505c\u7528\u63d2\u4ef6\uff0c\u7136\u540e\u518d\u6b21\u6fc0\u6d3b\u5b83\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u521b\u5efa\u9875\u9762\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230 member-password-lost \u800c\u4e0d\u662f wp-login?action=lostpassword\u3002 <\/p>\n<h3>\u7b2c 2 \u6b65\uff1a\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u81ea\u5b9a\u4e49\u9875\u9762<\/h3>\n<p>\u6b63\u5982\u6211\u4e0a\u9762\u63d0\u5230\u7684\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u64cd\u4f5c login_form_{action} \u6216 login_form_lostpassword \u5728 wp-login \u4e4b\u524d\u5207\u5165.php \u6709\u673a\u4f1a\u5448\u73b0\u201c\u4e22\u5931\u5bc6\u7801\uff1f\u201d\u7684\u9ed8\u8ba4\u7248\u672c\u3002\u5c4f\u5e55\u3002<\/p>\n<p>\u5728\u63d2\u4ef6\u7684\u6784\u9020\u51fd\u6570\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>add_action( 'login_form_lostpassword', array( $this, 'redirect_to_custom_lostpassword' ) );\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u521b\u5efa\u51fd\u6570 redirect_to_custom_lostpassword\u3002 <\/p>\n<p>\u6b64\u51fd\u6570\u5c06\u68c0\u67e5\u8bf7\u6c42\u65b9\u6cd5\uff1a\u76ee\u524d\uff0c\u6211\u4eec\u4ec5\u5bf9\u4f7f\u7528 GET \u65b9\u6cd5\u53d1\u9001\u7684\u8bf7\u6c42\u8fdb\u884c\u64cd\u4f5c\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u662f\u7528\u4e8e\u663e\u793a\u5c4f\u5e55\u7684\u8bf7\u6c42\u3002\u7a0d\u540e\u6211\u4eec\u5c06\u770b\u770b POST \u53d1\u751f\u4e86\u4ec0\u4e48\u3002<\/p>\n<pre>\/**\n * Redirects the user to the custom \"Forgot your password?\" page instead of\n * wp-login.php?action=lostpassword.\n *\/\npublic function redirect_to_custom_lostpassword() {\n    if ( 'GET' == $_SERVER['REQUEST_METHOD'] ) {\n        if ( is_user_logged_in() ) {\n            $this-&amp;gt;redirect_logged_in_user();\n            exit;\n        }\n\n        wp_redirect( home_url( 'member-password-lost' ) );\n        exit;\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u529f\u80fd\u5b9e\u9645\u4e0a\u4e0e\u6211\u4eec\u5728\u4e0a\u4e00\u7bc7\u6559\u7a0b\u4e2d\u7528\u4e8e\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u81ea\u5b9a\u4e49\u6ce8\u518c\u9875\u9762\u7684\u529f\u80fd\u76f8\u540c\uff0c\u53ea\u662f\u5c06\u91cd\u5b9a\u5411\u66ff\u6362\u4e3a\u6211\u4eec\u4e0a\u9762\u521b\u5efa\u7684\u65b0\u9875\u9762\u7684\u9875\u9762slug\uff08\u5bf9\u4e8e\u67d0\u4e9b\u4eba\u6765\u8bf4\u8fd9\u662f\u4e00\u4e2a\u597d\u5730\u65b9\uff09\u4e5f\u8bb8\u5c06\u6765\u4f1a\u91cd\u6784\uff1f\uff09\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u5982\u679c\u60a8\u5728\u767b\u5f55\u9875\u9762\u4e0a\u70b9\u51fb<strong>\u5fd8\u8bb0\u4e86 WordPress \u5bc6\u7801\uff1f<\/strong>\uff0c\u60a8\u5c06\u88ab\u91cd\u5b9a\u5411\u5230 WordPress \u81ea\u5b9a\u4e49\u5bc6\u7801\u91cd\u7f6e\u9875\u9762\u3002\u63a5\u4e0b\u6765\uff0c\u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u77ed\u4ee3\u7801\u6765\u6dfb\u52a0\u7528\u4e8e\u542f\u52a8\u5bc6\u7801\u91cd\u7f6e\u7684 WordPress \u5bc6\u7801\u8868\u5355\u3002<\/p>\n<h3>\u7b2c 3 \u6b65\uff1a\u4e3a WordPress \u66f4\u6539\u5bc6\u7801\u8868\u5355\u521b\u5efa\u7b80\u7801<\/h3>\n<p>\u5728\u521b\u5efa\u7528\u4e8e\u542f\u52a8 WordPress \u5bc6\u7801\u91cd\u7f6e\u7684\u9875\u9762\u65f6\uff0c\u6211\u4eec\u5c06\u77ed\u4ee3\u7801 [custom-lost-password-form] \u6dfb\u52a0\u5230\u5176\u6b63\u6587\u4e2d\u3002\u73b0\u5728\uff0c\u4e3a\u4e86\u7528\u8868\u5355\u66ff\u6362\u77ed\u4ee3\u7801\uff0c\u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u77ed\u4ee3\u7801\u5904\u7406\u7a0b\u5e8f\u3002<\/p>\n<p>\u5728\u63d2\u4ef6\u7684\u6784\u9020\u51fd\u6570\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>add_shortcode( 'custom-password-lost-form', array( $this, 'render_password_lost_form' ) );\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u521b\u5efa\u7528\u4e8e\u6e32\u67d3\u8868\u5355\u7684\u51fd\u6570\uff1a<\/p>\n<pre>\/**\n * A shortcode for rendering the form used to initiate the password reset.\n *\n * @param  array   $attributes  Shortcode attributes.\n * @param  string  $content     The text content for shortcode. Not used.\n *\n * @return string  The shortcode output\n *\/\npublic function render_password_lost_form( $attributes, $content = null ) {\n    \/\/ Parse shortcode attributes\n    $default_attributes = array( 'show_title' =&amp;gt; false );\n    $attributes = shortcode_atts( $default_attributes, $attributes );\n\n    if ( is_user_logged_in() ) {\n        return __( 'You are already signed in.', 'personalize-login' );\n    } else {\n        return $this-&amp;gt;get_template_html( 'password_lost_form', $attributes );\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u73b0\u5728\uff0c\u8fd9\u4e2a\u51fd\u6570\u7684\u5927\u90e8\u5206\u5185\u5bb9\u4f60\u5df2\u7ecf\u5f88\u719f\u6089\u4e86\uff1a\u9996\u5148\u6211\u4eec\u89e3\u6790\u77ed\u4ee3\u7801\u53c2\u6570\uff08show_title \u7528\u4e8e\u51b3\u5b9a\u662f\u5426\u5e94\u8be5\u5728\u542f\u52a8\u5bc6\u7801\u91cd\u7f6e\u7684\u8868\u5355\u4e4b\u524d\u5448\u73b0\u6807\u9898\uff09 \u3002\u7136\u540e\uff0c\u5982\u679c\u7528\u6237\u672a\u767b\u5f55\uff0c\u8be5\u51fd\u6570\u5c06\u5448\u73b0\u4e00\u4e2a\u5305\u542b WordPress \u5fd8\u8bb0\u5bc6\u7801\u8868\u5355\u7684\u6a21\u677f\u3002 <\/p>\n<p>\u73b0\u5728\u8ba9\u6211\u4eec\u6dfb\u52a0\u8be5\u6a21\u677f\u3002\u5728 templates \u76ee\u5f55\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u547d\u540d\u4e3a password_lost_form.php\u3002\u7136\u540e\uff0c\u5c06\u4ee5\u4e0b\u4ee3\u7801\u6dfb\u52a0\u5230\u8be5\u6a21\u677f\uff1a<\/p>\n<pre>&lt;div id=\"password-lost-form\" class=\"widecolumn\"&gt;\n    &lt;?php if ( $attributes['show_title'] ) : ?&gt;&lt;h3&gt;&lt;?php _e( 'Forgot Your Password?', 'personalize-login' ); ?&gt;&lt;\/h3&gt;\n    &lt;?php endif; ?&gt;&lt;p&gt;\n        &lt;?php _e(\n                \"Enter your email address and we'll send you a link you can use to pick a new password.\",\n                'personalize_login'\n            );\n        ?&gt;&lt;\/p&gt;\n\n    &lt;form id=\"lostpasswordform\" action=\"&amp;lt;?php%20echo%20wp_lostpassword_url();%20?&amp;gt;\" method=\"post\"&gt;\n        &lt;p class=\"form-row\"&gt;\n            &lt;label for=\"user_login\"&gt;&lt;?php _e( 'Email', 'personalize-login' ); ?&gt;&lt;input type=\"text\" name=\"user_login\" id=\"user_login\"&gt;&lt;\/label&gt;&lt;\/p&gt;\n\n        &lt;p class=\"lostpassword-submit\"&gt;\n            &lt;input type=\"submit\" name=\"submit\" class=\"lostpassword-button\" value=\"&amp;lt;?php _e( 'Reset Password', 'personalize-login' ); ?&amp;gt;\"&gt;&lt;\/p&gt;\n    &lt;\/form&gt;\n&lt;\/div&gt;\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c show_title \u5c5e\u6027\u8bbe\u7f6e\u4e3a true\uff08<strong>\u7b2c 2-4 \u884c<\/strong>\uff09\uff0c\u6a21\u677f\u9996\u5148\u663e\u793a\u6807\u9898\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u662f\u5173\u4e8e<strong>\u7b2c 6-13 \u884c<\/strong>\u7684\u4e00\u4e9b\u8bf4\u660e\u548c\u5b9e\u9645\u8868\u683c\u3002\u6b63\u5982\u60a8\u5728<strong>\u7b2c 15 \u884c<\/strong>\u4e2d\u770b\u5230\u7684\uff0c\u8868\u5355\u5c06\u53d1\u5e03\u5230 WordPress \u51fd\u6570 wp_lostpassword_url \u8fd4\u56de\u7684\u7f51\u5740\uff0c\u8be5\u7f51\u5740\u4e0e\u6211\u4eec\u5728\u91cd\u5b9a\u5411\u7528\u6237\u65f6\u5728\u4e0a\u9762\u770b\u5230\u7684\u7f51\u5740\u76f8\u540c\u5230\u6211\u4eec\u7684\u81ea\u5b9a\u4e49\u9875\u9762\u3002<\/p>\n<p>\u6b64\u8868\u5355\u4ec5\u5305\u542b\u4e00\u4e2a\u6587\u672c\u5b57\u6bb5\uff0cuser_login\uff08<strong>\u7b2c 18 \u884c<\/strong>\uff09\u3002\u5728\u6b64\u5b57\u6bb5\u4e2d\uff0c\u9ed8\u8ba4\u7684 WordPress \u91cd\u7f6e\u5bc6\u7801\u529f\u80fd\u63a5\u53d7\u7528\u6237\u7684\u7528\u6237\u540d\u6216\u7535\u5b50\u90ae\u4ef6\u3002\u7531\u4e8e\u6211\u4eec\u4f7f\u7528\u7535\u5b50\u90ae\u4ef6\u4f5c\u4e3a\u7528\u6237\u540d\uff0c\u56e0\u6b64\u5b83\u4eec\u662f\u76f8\u540c\u7684\uff0c\u56e0\u6b64\u6211\u4eec\u53ea\u8981\u6c42\u5b57\u6bb5\u6807\u7b7e\u4e2d\u7684\u7535\u5b50\u90ae\u4ef6\uff08<strong>\u7b2c 17 \u884c<\/strong>\uff09\u3002<\/p>\n<p>\u6dfb\u52a0\u6b64\u6a21\u677f\u540e\uff0c\u5f53\u60a8\u70b9\u51fb\u767b\u5f55\u9875\u9762\u4e0a\u7684<strong>\u5fd8\u8bb0\u5bc6\u7801\uff1f<\/strong>\u6d88\u606f\u6a21\u677f\u94fe\u63a5\u65f6\uff0c\u60a8\u5c06\u770b\u5230\u5982\u4e0b\u6240\u793a\u7684\u9875\u9762\uff08\u5982\u679c\u4f7f\u7528 WordPress \u9ed8\u8ba4\u4e3b\u9898\uff09\u5c31\u50cf<em>\u4e8c\u5341\u5341\u4e94<\/em>\uff09<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/465\/014\/169375350758961.png\" class=\"aligncenter\" title=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe1\" alt=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe1\" \/><\/p>\n<h3>\u7b2c 4 \u6b65\uff1a\u5904\u7406 WordPress \u5e10\u6237\u6062\u590d\u8868\u5355\u63d0\u4ea4<\/h3>\n<p>\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u521b\u5efa\u4e86 WordPress \u5bc6\u7801\u8868\u5355\uff0c\u662f\u65f6\u5019\u770b\u770b\u7528\u6237\u63d0\u4ea4\u5b83\u65f6\u4f1a\u53d1\u751f\u4ec0\u4e48\u4e86\u3002<\/p>\n<p>\u4e3a\u4e86\u8ba9\u6211\u4eec\u5728\u4e0d\u8bc9\u8bf8\u9ed1\u5ba2\u7684\u60c5\u51b5\u4e0b\u8fdb\u884c\u6b63\u786e\u7684\u9519\u8bef\u5904\u7406\uff0c\u6211\u4eec\u9700\u8981\u81ea\u5df1\u7f16\u5199\u4e00\u4e9b\u529f\u80fd &#8211; \u5c3d\u53ef\u80fd\u4f7f\u7528 wp-login.php \u4e2d\u7684\u8f85\u52a9\u51fd\u6570\uff0c\u81ea\u7136\u3002 <\/p>\n<p>\u4e3a\u6b64\uff0c\u6211\u4eec\u5c06\u5728 login_form_lostpassword \u64cd\u4f5c\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u51fd\u6570\u6765\u5904\u7406 POST \u8bf7\u6c42\u3002 <\/p>\n<p>\u8be5\u51fd\u6570\u5c06\u4f7f\u7528 retrieve_password \u51fd\u6570\u5b9a\u4e49\u5728 wp-login.php \u4e2d\u6765\u67e5\u627e\u7528\u6237\u5e76\u542f\u52a8\u5bc6\u7801\u66f4\u65b0\u8fc7\u7a0b\u3002\u7136\u540e\uff0c\u6839\u636e\u662f\u5426\u6709\u9519\u8bef\uff0c\u8be5\u51fd\u6570\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u6b63\u786e\u7684\u9875\u9762\uff1a\u5982\u679c\u51fa\u73b0\u9519\u8bef\uff0c\u5219\u8fd4\u56de\u5230<strong>\u5fd8\u8bb0\u5bc6\u7801\uff1f <\/strong>\u6d88\u606f\u6a21\u677f\u9875\u9762\uff0c\u6210\u529f\u540e\uff0c\u8fdb\u5165\u767b\u5f55\u9875\u9762\u3002<\/p>\n<p>\u5728\u6784\u9020\u51fd\u6570\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>add_action( 'login_form_lostpassword', array( $this, 'do_password_lost' ) );\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u521b\u5efa\u51fd\u6570\uff1a<\/p>\n<pre>\/**\n * Initiates password reset.\n *\/\npublic function do_password_lost() {\n    if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {\n        $errors = retrieve_password();\n        if ( is_wp_error( $errors ) ) {\n            \/\/ Errors found\n            $redirect_url = home_url( 'member-password-lost' );\n            $redirect_url = add_query_arg( 'errors', join( ',', $errors-&amp;gt;get_error_codes() ), $redirect_url );\n        } else {\n            \/\/ Email sent\n            $redirect_url = home_url( 'member-login' );\n            $redirect_url = add_query_arg( 'checkemail', 'confirm', $redirect_url );\n        }\n\n        wp_redirect( $redirect_url );\n        exit;\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u51fd\u6570\u9996\u5148\u68c0\u67e5\u8bf7\u6c42\u65b9\u6cd5\uff08\u5728<strong>\u7b2c 5 \u884c<\/strong>\u4e0a\uff09\u3002\u7531\u4e8e\u6211\u4eec\u5bf9\u63d0\u4ea4\u5bc6\u7801\u4e22\u5931\u8868\u5355\u65f6\u7684\u60c5\u51b5\u611f\u5174\u8da3\uff0c\u56e0\u6b64\u8be5\u51fd\u6570\u4ec5\u5728\u627e\u5230 POST \u8bf7\u6c42\u65f6\u624d\u4f1a\u8df3\u8f6c\u3002 GET \u8bf7\u6c42\u5df2\u7531\u6211\u4eec\u4e4b\u524d\u521b\u5efa\u7684\u51fd\u6570 redirect_to_custom_lostpassword \u5904\u7406\u3002<\/p>\n<p>\u7136\u540e\uff0c\u5728<strong>\u7b2c 6 \u884c<\/strong>\uff0c\u6211\u4eec\u8c03\u7528 WordPress \u51fd\u6570 retrieve_password\u3002\u8be5\u51fd\u6570\u7684\u540d\u79f0\u6709\u70b9\u8bef\u5bfc\uff1a\u8be5\u51fd\u6570\u5e76\u4e0d\u771f\u6b63\u68c0\u7d22\u5bc6\u7801\uff0c\u800c\u662f\u68c0\u67e5\u8868\u5355\u4e2d\u7684\u6570\u636e\uff0c\u7136\u540e\u901a\u8fc7\u521b\u5efa\u91cd\u7f6e WP \u5bc6\u7801\u4ee4\u724c\u5e76\u5c06\u5176\u901a\u8fc7\u7535\u5b50\u90ae\u4ef6\u53d1\u9001\u7ed9\u7528\u6237\uff0c\u4e3a WordPress \u5bc6\u7801\u91cd\u7f6e\u51c6\u5907\u7528\u6237\u5e10\u6237\u3002 <\/p>\n<p>\u5982\u679c\u51fa\u73b0\u9519\u8bef\uff08<strong>\u7b2c 7 \u884c<\/strong>\uff09\uff0c\u6211\u4eec\u4f1a\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u56de\u9875\u9762 member-password-lost\uff0c\u5e76\u5c06\u9519\u8bef\u4ee3\u7801\u4f5c\u4e3a\u8bf7\u6c42\u53c2\u6570\u4f20\u9012\uff08 <strong>\u7b2c 8-10 \u884c<\/strong>\uff0c\u5b9e\u9645\u91cd\u5b9a\u5411\u5728<strong>\u7b2c 17 \u884c<\/strong>\u5b8c\u6210\uff09\u3002 <\/p>\n<p>\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u7528\u6237\u5c06\u88ab\u91cd\u5b9a\u5411\u5230\u5e26\u6709\u8bf7\u6c42\u53c2\u6570 checkemail \u8bbe\u7f6e\u7684\u767b\u5f55\u9875\u9762\uff08<strong>\u7b2c 12-14 \u884c<\/strong>\uff09\uff0c\u4ee5\u4fbf\u6211\u4eec\u53ef\u4ee5\u5411\u7528\u6237\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u5982\u679c\u60a8\u63d0\u4ea4 WordPress \u5bc6\u7801\u8868\u5355\uff0c\u4e00\u5207\u90fd\u5e94\u8be5\u6b63\u5e38\u3002\u4f46\u4e3a\u4e86\u4f7f\u7528\u6237\u4f53\u9a8c\u5b8c\u6574\uff0c\u6211\u4eec\u9700\u8981\u8fd4\u56de\u5230\u5448\u73b0\u4e22\u5931\u5bc6\u7801\u548c\u767b\u5f55\u8868\u5355\u7684\u77ed\u4ee3\u7801\uff0c\u5e76\u663e\u793a\u9519\u8bef\u548c\u6210\u529f\u901a\u77e5\u3002<\/p>\n<p>\u8ba9\u6211\u4eec\u4ece\u79ef\u6781\u7684\u65b9\u9762\u5f00\u59cb\uff0c\u6dfb\u52a0\u6210\u529f\u6d88\u606f\u3002 <\/p>\n<p>\u5728\u77ed\u4ee3\u7801\u51fd\u6570 render_login_form \u4e2d\uff0c\u5728 get_template_html \u8c03\u7528\u4e4b\u524d\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>\/\/ Check if the user just requested a new password \n$attributes['lost_password_sent'] = isset( $_REQUEST['checkemail'] ) &amp;amp;&amp;amp; $_REQUEST['checkemail'] == 'confirm';\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u8868\u5355\u6a21\u677f\u4e2d\uff0c\u4f7f\u7528\u4e0a\u9762\u7684\u5c5e\u6027\u6dfb\u52a0\u4e00\u6761\u6d88\u606f\uff1a<\/p>\n<pre>&lt;?php if ( $attributes['lost_password_sent'] ) : ?&gt;&lt;p class=\"login-info\"&gt;\n        &lt;?php _e( 'Check your email for a link to reset your password.', 'personalize-login' ); ?&gt;&lt;\/p&gt;\n&lt;?php endif; ?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u73b0\u5728\uff0c\u6210\u529f\u542f\u52a8\u5bc6\u7801\u91cd\u7f6e\u540e\uff0c<strong>\u767b\u5f55<\/strong>\u8868\u5355\u5e94\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/465\/014\/169375350744238.png\" class=\"aligncenter\" title=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe2\" alt=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe2\" \/><\/p>\n<p>\u8981\u663e\u793a\u9519\u8bef\uff0c\u6211\u4eec\u5c06\u8fd4\u56de\u5230\u4e22\u5931\u7684 WordPress \u66f4\u6539\u5bc6\u7801\u8868\u5355\u3002 <\/p>\n<p>\u9996\u5148\uff0c\u5728\u77ed\u4ee3\u7801\u5904\u7406\u7a0b\u5e8f render_password_lost_form \u4e2d\uff0c\u5728\u6e32\u67d3\u6a21\u677f\u4e4b\u524d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\u4ee5\u904d\u5386\u9519\u8bef\u4ee3\u7801\u5e76\u6536\u96c6\u6570\u7ec4 \u4e2d\u5339\u914d\u7684\u9519\u8bef\u6d88\u606f$attributes[&#8216;errors&#8217;]:<\/p>\n<pre>\/\/ Retrieve possible errors from request parameters\n$attributes['errors'] = array();\nif ( isset( $_REQUEST['errors'] ) ) {\n    $error_codes = explode( ',', $_REQUEST['errors'] );\n\n    foreach ( $error_codes as $error_code ) {\n        $attributes['errors'] []= $this-&amp;gt;get_error_message( $error_code );\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u5728\u6a21\u677f\u4e2d\uff0c\u6211\u4eec\u5c06\u5448\u73b0\u9519\u8bef\uff1a<\/p>\n<pre>&lt;?php if ( count( $attributes['errors'] ) &gt; 0 ) : ?&amp;gt;\n    &lt;?php foreach ( $attributes['errors'] as $error ) : ?&gt;&lt;p&gt;\n            &lt;?php echo $error; ?&gt;&lt;\/p&gt;\n    &lt;?php endforeach; ?&gt;&lt;?php endif; ?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6700\u540e\uff0c\u5c06\u9519\u8bef\u6d88\u606f\u6dfb\u52a0\u5230\u6211\u4eec\u7684\u51fd\u6570 get_error_messages\uff1a<\/p>\n<pre>\/\/ Lost password\n\ncase 'empty_username':\n    return __( 'You need to enter your email address to continue.', 'personalize-login' );\n\ncase 'invalid_email':\ncase 'invalidcombo':\n    return __( 'There are no users registered with this email address.', 'personalize-login' );\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u4e3a\u4e86\u5b8c\u6210\u5bc6\u7801\u91cd\u7f6e\u6d41\u7a0b\u7684\u7b2c\u4e00\u6b65\uff0c\u6211\u4eec\u6765\u770b\u770b\u5982\u4f55\u81ea\u5b9a\u4e49\u53d1\u9001\u7ed9\u7528\u6237\u7684\u7535\u5b50\u90ae\u4ef6\u3002<\/p>\n<h3>\u7b2c 5 \u6b65\uff1a\u81ea\u5b9a\u4e49 WordPress \u66f4\u6539\u5bc6\u7801\u7535\u5b50\u90ae\u4ef6<\/h3>\n<p>\u6b63\u5982\u6211\u4eec\u4e4b\u524d\u770b\u5230\u7684\uff0c\u5f53\u53d1\u9001\u91cd\u7f6e WP \u5bc6\u7801\u7684\u8bf7\u6c42\u65f6\uff0c\u5728\u51fd\u6570 retrieve_password \u4e2d\uff0c\u4f1a\u53d1\u9001\u4e00\u5c01 WordPress \u66f4\u6539\u5bc6\u7801\u7535\u5b50\u90ae\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u6709\u5173\u64cd\u4f5c\u7684\u5feb\u901f\u8bf4\u660e\u548c\u4e00\u4e2a\u94fe\u63a5\u53ef\u7528\u4e8e\u5b8c\u6210\u5bc6\u7801\u91cd\u7f6e\u3002<\/p>\n<p>\u6d88\u606f\u7b80\u77ed\u800c\u5207\u9898\u3002\u5b83\u5b8c\u6210\u4e86\u5b83\u5e94\u8be5\u505a\u7684\u4e8b\u60c5\uff0c\u4f46\u60a8\u53ef\u80fd\u60f3\u8981\u5bf9\u5176\u8fdb\u884c\u81ea\u5b9a\u4e49\u4ee5\u8d4b\u4e88\u5176\u4e2a\u4eba\u98ce\u683c\uff0c\u5e76\u53ef\u80fd\u4f7f\u5176\u66f4\u5177\u63cf\u8ff0\u6027\u3002<\/p>\n<p>\u9ed8\u8ba4\u6587\u672c\u88ab\u786c\u7f16\u7801\u5728 wp-login.php \u4e2d\uff0c\u4f46\u5728\u53d1\u9001\u6d88\u606f\u4e4b\u524d\uff0cWordPress \u4e3a\u63d2\u4ef6\u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\u4e86\u4f7f\u7528\u4e24\u4e2a\u8fc7\u6ee4\u5668\u66ff\u6362\u5b83\u7684\u673a\u4f1a\u3002<\/p>\n<p>\u9996\u5148\uff0c\u8981\u66ff\u6362\u6d88\u606f\u6b63\u6587\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u8fc7\u6ee4\u5668 retrieve_password_message\u3002\u6211\u4eec\u73b0\u5728\u5c31\u5f00\u59cb\u5427\u3002<\/p>\n<p>\u5728\u63d2\u4ef6\u7684\u6784\u9020\u51fd\u6570\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>add_filter( 'retrieve_password_message', array( $this, 'replace_retrieve_password_message' ), 10, 4 );\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u521b\u5efa\u51fd\u6570 replace_retrieve_password_message\uff1a<\/p>\n<pre>\/**\n * Returns the message body for the password reset mail.\n * Called through the retrieve_password_message filter.\n *\n * @param string  $message    Default mail message.\n * @param string  $key        The activation key.\n * @param string  $user_login The username for the user.\n * @param WP_User $user_data  WP_User object.\n *\n * @return string   The mail message to send.\n *\/\npublic function replace_retrieve_password_message( $message, $key, $user_login, $user_data ) {\n    \/\/ Create new message\n    $msg  = __( 'Hello!', 'personalize-login' ) . \"\r\n\r\n\";\n    $msg .= sprintf( __( 'You asked us to reset your password for your account using the email address %s.', 'personalize-login' ), $user_login ) . \"\r\n\r\n\";\n    $msg .= __( \"If this was a mistake, or you didn't ask for a password reset, just ignore this email and nothing will happen.\", 'personalize-login' ) . \"\r\n\r\n\";\n    $msg .= __( 'To reset your password, visit the following address:', 'personalize-login' ) . \"\r\n\r\n\";\n    $msg .= site_url( \"wp-login.php?action=rp&amp;amp;key=$key&amp;amp;login=\" . rawurlencode( $user_login ), 'login' ) . \"\r\n\r\n\";\n    $msg .= __( 'Thanks!', 'personalize-login' ) . \"\r\n\";\n\n    return $msg;\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u51fd\u6570\u63a5\u6536\u56db\u4e2a\u53c2\u6570\uff1a<\/p>\n<ul>\n<li> $message \u662f\u53d1\u9001\u7ed9\u7528\u6237\u7684\u6d88\u606f\u7684\u9ed8\u8ba4\u7248\u672c\u3002\u6211\u4eec\u5c06\u5ffd\u7565\u6b64\u53c2\u6570\u5e76\u4ece\u5934\u5f00\u59cb\u521b\u5efa\u6211\u4eec\u81ea\u5df1\u7684\u6587\u672c\u3002<\/li>\n<li> $key \u662f\u7528\u4e8e\u9a8c\u8bc1\u7528\u6237\u5bc6\u7801\u91cd\u7f6e\u8bf7\u6c42\u7684\u4ee4\u724c\u3002\u5b83\u9700\u8981\u5305\u542b\u5728\u5bc6\u7801\u91cd\u7f6e\u94fe\u63a5\u4e2d\u3002<\/li>\n<li> $user_login \u662f\u7528\u6237\u7684\u7528\u6237\u540d\uff08\u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\u662f\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff09\uff0c\u5bc6\u7801\u91cd\u7f6e\u94fe\u63a5\u4e2d\u4e5f\u9700\u8981\u5b83\u3002<\/li>\n<li> $user_data \u5305\u542b\u6709\u5173\u7528\u6237\u7684\u4e00\u4e9b\u6570\u636e\u3002\u6211\u4eec\u6682\u65f6\u5ffd\u7565\u8fd9\u4e00\u70b9\uff0c\u4f46\u5982\u679c\u60a8\u613f\u610f\uff0c\u53ef\u4ee5\u5728\u81ea\u5df1\u7684\u81ea\u5b9a\u4e49\u4e2d\u8fdb\u4e00\u6b65\u63a2\u7d22\u5b83\u3002<\/li>\n<\/ul>\n<p>\u5927\u90e8\u5206\u51fd\u6570\u53ea\u662f\u5c06\u6d88\u606f\u521b\u5efa\u4e3a\u4e00\u7cfb\u5217\u5b57\u7b26\u4e32\u8fde\u63a5\u3002\u7528\u4e8e\u5b8c\u6210\u5bc6\u7801\u91cd\u7f6e\u7684 URL \u662f\u5728<strong>\u7b2c 18 \u884c<\/strong>\u521b\u5efa\u7684\u3002<\/p>\n<p>\u4e3a\u4e86\u8fdb\u884c\u66f4\u5b8c\u6574\u7684\u81ea\u5b9a\u4e49\uff0c\u4e00\u79cd\u60f3\u6cd5\u662f\u6dfb\u52a0\u4e00\u4e2a\u8bbe\u7f6e\u5b57\u6bb5\u6765\u7f16\u8f91\u5bc6\u7801\u68c0\u7d22\u6d88\u606f\u7684\u5185\u5bb9\uff0c\u5e76\u4f7f\u7528\u5b83\u800c\u4e0d\u662f\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u5728\u51fd\u6570\u5185\u7f16\u7801\u6d88\u606f\u3002<\/p>\n<p>\u5982\u679c\u60a8\u613f\u610f\uff0c\u53ef\u4ee5\u4f7f\u7528\u8fc7\u6ee4\u5668 retrieve_password_title \u4ee5\u540c\u6837\u7684\u65b9\u5f0f\u66ff\u6362\u7535\u5b50\u90ae\u4ef6\u6807\u9898\u3002\u8fc7\u6ee4\u5668\u51fd\u6570\u91c7\u7528\u4e00\u4e2a\u53c2\u6570\uff0c\u5373\u8981\u53d1\u9001\u7ed9\u7528\u6237\u7684\u9ed8\u8ba4\u6807\u9898\uff0c\u5e76\u4e14\u5e94\u8fd4\u56de\u65b0\u6807\u9898\u3002 <\/p>\n<p>\u8fdb\u4e00\u6b65\u81ea\u5b9a\u4e49\u7684\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u66ff\u6362\u6574\u4e2a\u6d88\u606f\u5e76\u53d1\u9001 HTML \u6d88\u606f\uff0c\u4f8b\u5982\u4f7f\u7528\u6211\u5728\u4e4b\u524d\u5173\u4e8e\u4f7f\u7528 Mandrill \u4ece WordPress \u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u7684\u6559\u7a0b\u4e2d\u89e3\u91ca\u7684\u65b9\u6cd5\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u5c06\u4f7f\u7528 Mandrill API \u5728\u4e0a\u9762\u7684\u8fc7\u6ee4\u5668\u51fd\u6570\u4e2d\u53d1\u9001\u6d88\u606f\u5e76\u8fd4\u56de false\uff0c\u4ee5\u4fbf WordPress \u4e0d\u4f1a\u518d\u6b21\u5c1d\u8bd5\u53d1\u9001\u7535\u5b50\u90ae\u4ef6\u3002<\/p>\n<p>\u60a8\u73b0\u5728\u5df2\u7ecf\u5b8c\u6210\u4e86 WordPress \u5bc6\u7801\u91cd\u7f6e\u8fc7\u7a0b\u7684\u7b2c\u4e00\u6b65\uff1a\u7528\u6237\u53ef\u4ee5\u8981\u6c42\u91cd\u7f6e WP \u5bc6\u7801\uff0c\u8be5\u8fc7\u7a0b\u7531 WordPress \u542f\u52a8\u3002 <\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u4e86\u89e3\u5f53\u7528\u6237\u5355\u51fb WordPress \u66f4\u6539\u5bc6\u7801\u7535\u5b50\u90ae\u4ef6\u4e2d\u7684\u94fe\u63a5\u65f6\u4f1a\u53d1\u751f\u4ec0\u4e48\u3002<\/p>\n<h2>\u91cd\u7f6e WordPress \u5bc6\u7801<\/h2>\n<p>\u6b63\u5982\u6211\u4eec\u5728\u4e0a\u9762\u770b\u5230\u7684\uff0c\u542f\u52a8 WordPress \u91cd\u7f6e\u5bc6\u7801\u540e\uff0c\u7528\u6237\u5c06\u88ab\u91cd\u5b9a\u5411\u56de\u767b\u5f55\u9875\u9762\uff0c\u5e76\u9644\u6709\u68c0\u67e5\u7535\u5b50\u90ae\u4ef6\u7684\u8bf4\u660e\u3002 <\/p>\n<p>\u5728 WordPress \u66f4\u6539\u5bc6\u7801\u7535\u5b50\u90ae\u4ef6\u4e2d\uff0c\u6709\u4e00\u4e2a\u8fd4\u56de wp-login.php \u7684\u94fe\u63a5\uff0c\u5176\u4e2d\u53c2\u6570 login \u548c key \u7528\u4e8e\u8bc6\u522b\u7528\u6237\u5e76\u9a8c\u8bc1 WordPress \u5bc6\u7801\u91cd\u7f6e\u8bf7\u6c42\u3002\u5f53\u7528\u6237\u5355\u51fb\u94fe\u63a5\u65f6\uff0cWordPress \u4f1a\u9a8c\u8bc1\u7528\u6237\u548c\u5bc6\u94a5\u7684\u6709\u6548\u6027\uff0c\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u5219\u8ba9\u7528\u6237\u8bbe\u7f6e\u65b0\u5bc6\u7801\u3002<\/p>\n<p>\u8be5\u529f\u80fd\u8fd0\u884c\u826f\u597d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u5176\u4e2d\u7684\u4e00\u90e8\u5206\uff0c\u8c03\u7528 wp-login.php \u4e2d\u7684\u73b0\u6709\u8f85\u52a9\u51fd\u6570\uff0c\u4f46\u540c\u6837\uff0c\u7531\u4e8e\u64cd\u4f5c\u548c\u8fc7\u6ee4\u5668\u5728 WordPress \u4e2d\u7684\u7ec4\u7ec7\u65b9\u5f0f\u5bc6\u7801\u91cd\u7f6e\u4ee3\u7801\uff0c\u6211\u4eec\u5fc5\u987b\u91cd\u5199\u4e00\u4e9b\u4ee3\u7801\u624d\u80fd\u5b8c\u6210\u5b9a\u5236\u3002<\/p>\n<h3>\u7b2c 1 \u6b65\uff1a\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u60a8\u7684 WordPress \u81ea\u5b9a\u4e49\u5bc6\u7801\u91cd\u7f6e\u9875\u9762<\/h3>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u5c06\u9996\u5148\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u6211\u4eec\u81ea\u5df1\u7684 WordPress \u81ea\u5b9a\u4e49\u5bc6\u7801\u91cd\u7f6e\u9875\u9762\uff08\u6211\u4eec\u5728\u672c\u6559\u7a0b\u5f00\u59cb\u65f6\u521b\u5efa\u7684\u9875\u9762\uff09\u3002 <\/p>\n<p>\u73b0\u5728\uff0c\u60a8\u53ef\u80fd\u5df2\u7ecf\u719f\u6089\u4e86\uff1a\u4e0e\u6211\u4eec\u5728\u767b\u5f55\u548c\u6ce8\u518c\u64cd\u4f5c\u4ee5\u53ca\u91cd\u7f6e WP \u5bc6\u7801\u6d41\u7a0b\u4e2d\u7684\u7b2c\u4e00\u9875\u4e2d\u6240\u505a\u7684\u76f8\u540c\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u64cd\u4f5c login_form_{action} \u5728 WordPress \u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u4e4b\u524d\u5c06\u5bc6\u7801\u91cd\u7f6e\u64cd\u4f5c\u8f6c\u79fb\u5230\u6211\u4eec\u81ea\u5df1\u7684\u81ea\u5b9a\u4e49\u51fd\u6570\u3002 <\/p>\n<p>\u6709\u4e24\u4e2a wp-login.php \u64cd\u4f5c\u7528\u4e8e\u76f8\u540c\u7684\u529f\u80fd\uff0crp \u548c resetpass\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5c06\u5b83\u4eec\u91cd\u5b9a\u5411\u5230\u540c\u4e00\u51fd\u6570\uff0credirect_to_custom_password_reset\u3002<\/p>\n<p>\u5728\u63d2\u4ef6\u7684\u6784\u9020\u51fd\u6570\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>add_action( 'login_form_rp', array( $this, 'redirect_to_custom_password_reset' ) );\nadd_action( 'login_form_resetpass', array( $this, 'redirect_to_custom_password_reset' ) );\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u521b\u5efa\u51fd\u6570\uff1a<\/p>\n<pre>\/**\n * Redirects to the custom password reset page, or the login page\n * if there are errors.\n *\/\npublic function redirect_to_custom_password_reset() {\n    if ( 'GET' == $_SERVER['REQUEST_METHOD'] ) {\n        \/\/ Verify key \/ login combo\n        $user = check_password_reset_key( $_REQUEST['key'], $_REQUEST['login'] );\n        if ( ! $user || is_wp_error( $user ) ) {\n            if ( $user &amp;amp;&amp;amp; $user-&amp;gt;get_error_code() === 'expired_key' ) {\n                wp_redirect( home_url( 'member-login?login=expiredkey' ) );\n            } else {\n                wp_redirect( home_url( 'member-login?login=invalidkey' ) );\n            }\n            exit;\n        }\n\n        $redirect_url = home_url( 'member-password-reset' );\n        $redirect_url = add_query_arg( 'login', esc_attr( $_REQUEST['login'] ), $redirect_url );\n        $redirect_url = add_query_arg( 'key', esc_attr( $_REQUEST['key'] ), $redirect_url );\n\n        wp_redirect( $redirect_url );\n        exit;\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u51fd\u6570\u9996\u5148\u68c0\u67e5\u8fd9\u662f\u4e00\u4e2a GET \u8bf7\u6c42\u3002 POST \u53d1\u9001\u5230\u540c\u4e00 URL \u7684\u8bf7\u6c42\u5c06\u5728\u4e0b\u9762\u5904\u7406\u3002 <\/p>\n<p>\u7136\u540e\uff0c\u5728\u7b2c 8 \u884c\uff0c\u6211\u4eec\u8c03\u7528 WordPress \u51fd\u6570 check_password_reset_key \u6765\u9a8c\u8bc1\u901a\u8fc7\u91cd\u7f6e WP \u5bc6\u7801\u94fe\u63a5\u4f20\u9012\u7684\u53c2\u6570\u662f\u5426\u6709\u6548\u3002\u5982\u679c\u51fa\u73b0\u9519\u8bef\uff0c\u6211\u4eec\u4f1a\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u56de\u767b\u5f55\u9875\u9762\uff0c\u5e76\u5c06\u9519\u8bef\u4ee3\u7801\u4f5c\u4e3a\u8bf7\u6c42\u53c2\u6570\uff08<strong>\u7b2c 9-16 \u884c<\/strong>\uff09\u3002\u6211\u4eec\u5f88\u5feb\u5c31\u4f1a\u6dfb\u52a0\u663e\u793a\u9519\u8bef\u7684\u4ee3\u7801\u3002<\/p>\n<p>\u5982\u679c\u53c2\u6570\u5df2\u6210\u529f\u9a8c\u8bc1\u5e76\u4e14\u5141\u8bb8\u7528\u6237\u66f4\u65b0\u5176\u5bc6\u7801\uff0c\u8be5\u529f\u80fd\u5c06\u7ee7\u7eed\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u6211\u4eec\u7684 WordPress \u81ea\u5b9a\u4e49\u5bc6\u7801\u91cd\u7f6e\u9875\u9762\uff08\u4ecd\u4e3a\u7a7a\uff09member-password-reset\u3002 <\/p>\n<p>\u5728\u7b2c 19-20 \u884c\uff0c\u6211\u4eec\u5c06\u53c2\u6570 key \u548c login \u6dfb\u52a0\u5230\u91cd\u5b9a\u5411 URL\uff0c\u4ee5\u4fbf\u5176\u4ed6\u4eba\u53ef\u4ee5\u4f7f\u7528\u5b83\u4eec\u68c0\u67e5\u7528\u6237\u4f55\u65f6\u5c1d\u8bd5\u5728\u4e0b\u4e00\u4e2a\u5c4f\u5e55\u4e0a\u8bbe\u7f6e\u65b0\u5bc6\u7801\u3002\u9ed8\u8ba4\u7248\u672c\u7684 WordPress \u5bc6\u7801\u91cd\u7f6e\u4f7f\u7528 cookie\uff0c\u4f46\u4e3a\u4e86\u6559\u7a0b\u7684\u76ee\u7684\uff0c\u6211\u51b3\u5b9a\u4f7f\u7528\u8bf7\u6c42\u53c2\u6570\u4ee5\u4f7f\u4ee3\u7801\u66f4\u6613\u4e8e\u7406\u89e3\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7248\u672c\u7684\u91cd\u7f6e WordPress \u5bc6\u7801\u8868\u5355\u3002<\/p>\n<h3>\u7b2c 2 \u6b65\uff1a\u663e\u793a WordPress \u66f4\u6539\u5bc6\u7801\u8868\u5355<\/h3>\n<p>\u70b9\u51fb<span>WordPress\u66f4\u6539\u5bc6\u7801\u7535\u5b50\u90ae\u4ef6<\/span>\u94fe\u63a5\u540e\u5411\u7528\u6237\u663e\u793a\u7684\u91cd\u7f6eWordPress\u5bc6\u7801\u8868\u5355\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/465\/014\/169375350797652.png\" class=\"aligncenter\" title=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe3\" alt=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe3\" \/><\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u8868\u5355\uff0c\u6709\u4e24\u4e2a\u5b57\u6bb5\uff0cpass1 \u548c pass2\uff0c\u4e00\u4e2a\u7528\u4e8e\u8f93\u5165 WordPress \u5bc6\u7801\uff0c\u53e6\u4e00\u4e2a\u7528\u4e8e\u91cd\u65b0\u8f93\u5165\u5bc6\u7801\u4ee5\u68c0\u67e5\u662f\u5426\u6709\u62fc\u5199\u9519\u8bef\u3002 <\/p>\n<p>\u8981\u521b\u5efa\u6b64\u8868\u5355\u7684\u81ea\u5b9a\u4e49\u7248\u672c\uff0c\u6211\u4eec\u5c06\u4f7f\u7528\u77ed\u4ee3\u7801\u3002 <\/p>\n<p>\u9996\u5148\uff0c\u5728\u63d2\u4ef6\u7684\u6784\u9020\u51fd\u6570\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>add_shortcode( 'custom-password-reset-form', array( $this, 'render_password_reset_form' ) );\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u521b\u5efa\u7528\u4e8e\u6e32\u67d3\u8868\u5355\u7684\u51fd\u6570\uff1a<\/p>\n<pre>\/**\n * A shortcode for rendering the form used to reset a user's password.\n *\n * @param  array   $attributes  Shortcode attributes.\n * @param  string  $content     The text content for shortcode. Not used.\n *\n * @return string  The shortcode output\n *\/\npublic function render_password_reset_form( $attributes, $content = null ) {\n    \/\/ Parse shortcode attributes\n    $default_attributes = array( 'show_title' =&amp;gt; false );\n    $attributes = shortcode_atts( $default_attributes, $attributes );\n\n    if ( is_user_logged_in() ) {\n        return __( 'You are already signed in.', 'personalize-login' );\n    } else {\n        if ( isset( $_REQUEST['login'] ) &amp;amp;&amp;amp; isset( $_REQUEST['key'] ) ) {\n            $attributes['login'] = $_REQUEST['login'];\n            $attributes['key'] = $_REQUEST['key'];\n\n            \/\/ Error messages\n            $errors = array();\n            if ( isset( $_REQUEST['error'] ) ) {\n                $error_codes = explode( ',', $_REQUEST['error'] );\n\n                foreach ( $error_codes as $code ) {\n                    $errors []= $this-&amp;gt;get_error_message( $code );\n                }\n            }\n            $attributes['errors'] = $errors;\n\n            return $this-&amp;gt;get_template_html( 'password_reset_form', $attributes );\n        } else {\n            return __( 'Invalid password reset link.', 'personalize-login' );\n        }\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u51fd\u6570\u7684\u6838\u5fc3\u4ece<strong>\u7b2c 17 \u884c<\/strong>\u5f00\u59cb\uff0c\u6211\u4eec\u5728\u5176\u4e2d\u68c0\u67e5\u7528\u6237\u8bc6\u522b\u53c2\u6570\u767b\u5f55\u540d\u548c\u5bc6\u94a5\u662f\u5426\u5b58\u5728\u3002\u5982\u679c\u4e0d\u662f\uff0c\u5219\u5bc6\u7801\u91cd\u7f6e\u94fe\u63a5\u65e0\u6548\uff0c\u6211\u4eec\u53ea\u4f1a\u5448\u73b0\u4e00\u6761\u9519\u8bef\u6d88\u606f\uff08<strong>\u7b2c 34 \u884c<\/strong>\uff09\u3002<\/p>\n<p>\u5982\u679c\u68c0\u67e5\u6b63\u5e38\uff0c\u8fd9\u4e24\u4e2a\u53d8\u91cf\u5c06\u6dfb\u52a0\u5230 $attributes \u6570\u7ec4\u4e2d\uff0c\u4ee5\u4f7f\u5b83\u4eec\u53ef\u7528\u4e8e\u8868\u5355\u6a21\u677f\uff08<strong>\u7b2c 18-19 \u884c<\/strong>\uff09\u3002 <\/p>\n<p>\u7136\u540e\uff0c\u5728<strong>\u7b2c 21-30 \u884c<\/strong>\uff0c\u6211\u4eec\u5df2\u7ecf\u4f7f\u7528\u672c\u6559\u7a0b\u4e2d\u65e9\u671f\u8868\u5355\u4e2d\u76f8\u540c\u7684\u9519\u8bef\u4f20\u9012\u65b9\u6cd5\uff0c\u4e3a\u63d0\u4ea4 WordPress \u5e10\u6237\u6062\u590d\u8868\u5355\u65f6\u53ef\u80fd\u53d1\u751f\u7684\u9519\u8bef\u505a\u597d\u4e86\u51c6\u5907\u3002 p&gt; <\/p>\n<p>\u6700\u540e\uff0c\u5728<strong>\u7b2c 32 \u884c<\/strong>\uff0c\u8be5\u51fd\u6570\u8bfb\u53d6\u6a21\u677f\u5e76\u5c06\u5176\u8fd4\u56de\u5230 WordPress \u8fdb\u884c\u6e32\u67d3\u3002 <\/p>\n<p>\u63a5\u4e0b\u6765\u8ba9\u6211\u4eec\u521b\u5efa\u6a21\u677f\u3002\u5728 templates \u76ee\u5f55\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u6587\u4ef6\uff0c\u5e76\u5c06\u5176\u547d\u540d\u4e3a password_reset_form.php\u3002\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre>&lt;div id=\"password-reset-form\" class=\"widecolumn\"&gt;\n    &lt;?php if ( $attributes['show_title'] ) : ?&gt;&lt;h3&gt;&lt;?php _e( 'Pick a New Password', 'personalize-login' ); ?&gt;&lt;\/h3&gt;\n    &lt;?php endif; ?&gt;&lt;form name=\"resetpassform\" id=\"resetpassform\" action=\"&amp;lt;?php%20echo%20site_url(%20'wp-login.php?action=resetpass'%20);%20?&amp;gt;\" method=\"post\" autocomplete=\"off\"&gt;\n        &lt;input type=\"hidden\" id=\"user_login\" name=\"rp_login\" value=\"&amp;lt;?php echo esc_attr( $attributes['login'] ); ?&amp;gt;\" autocomplete=\"off\"&gt;&lt;input type=\"hidden\" name=\"rp_key\" value=\"&amp;lt;?php echo esc_attr( $attributes['key'] ); ?&amp;gt;\"&gt;&lt;?php if ( count( $attributes['errors'] ) &gt; 0 ) : ?&amp;gt;\n            &lt;?php foreach ( $attributes['errors'] as $error ) : ?&gt;&lt;p&gt;\n                    &lt;?php echo $error; ?&gt;&lt;\/p&gt;\n            &lt;?php endforeach; ?&gt;&lt;?php endif; ?&gt;&lt;p&gt;\n            &lt;label for=\"pass1\"&gt;&lt;?php _e( 'New password', 'personalize-login' ) ?&gt;&lt;\/label&gt;\n            &lt;input type=\"password\" name=\"pass1\" id=\"pass1\" class=\"input\" size=\"20\" value=\"\" autocomplete=\"off\"&gt;&lt;\/p&gt;\n        &lt;p&gt;\n            &lt;label for=\"pass2\"&gt;&lt;?php _e( 'Repeat new password', 'personalize-login' ) ?&gt;&lt;\/label&gt;\n            &lt;input type=\"password\" name=\"pass2\" id=\"pass2\" class=\"input\" size=\"20\" value=\"\" autocomplete=\"off\"&gt;&lt;\/p&gt;\n        \n        &lt;p class=\"description\"&gt;&lt;?php echo wp_get_password_hint(); ?&gt;&lt;\/p&gt;\n        \n        &lt;p class=\"resetpass-submit\"&gt;\n            &lt;input type=\"submit\" name=\"submit\" id=\"resetpass-button\" class=\"button\" value=\"&amp;lt;?php _e( 'Reset Password', 'personalize-login' ); ?&amp;gt;\"&gt;&lt;\/p&gt;\n    &lt;\/form&gt;\n&lt;\/div&gt;\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8868\u5355\u4ee5\u53ef\u9009\u6807\u9898\u5f00\u5934\uff0c\u5982\u679c\u7b80\u7801\u5c5e\u6027 show_title \u8bbe\u7f6e\u4e3a true\uff08<strong>\u7b2c 2-4 \u884c<\/strong>\uff09\uff0c\u5219\u663e\u793a\u8be5\u6807\u9898\u3002 <\/p>\n<p>\u5b9e\u9645\u7684\u5f62\u5f0f\u7d27\u8ddf\u5728\u6807\u9898\u4e4b\u540e\u3002\u8bf7\u6ce8\u610f\uff0c\u8be5\u8868\u5355\u5c06\u53d1\u5e03\u5230 wp-login.php?action=resetpass\uff08<strong>\u7b2c 6 \u884c<\/strong>\uff09\uff0c\u4e0e\u5bc6\u7801\u91cd\u7f6e\u7535\u5b50\u90ae\u4ef6\u4e2d\u7684\u94fe\u63a5\u4e2d\u4f7f\u7528\u7684 URL \u76f8\u540c\uff0c\u4f46\u9664\u5916\u8be5\u7535\u5b50\u90ae\u4ef6\u94fe\u63a5\u4f7f\u7528\u4e86\u7b80\u77ed\u7248\u672c rp\uff0c\u800c\u4e0d\u662f resetpass\u3002<\/p>\n<p>\u5728\u8868\u5355\u7684\u5f00\u5934\uff08<strong>\u7b2c7-8\u884c<\/strong>\uff09\uff0c\u6211\u4eec\u8bbe\u7f6e\u4e86\u4e24\u4e2a\u9690\u85cf\u5b57\u6bb5rp_key\u548crp_login\u6765\u4f20\u9012key \u548c login \u53c2\u6570\u4f20\u9012\u7ed9\u8868\u5355\u5904\u7406\u7a0b\u5e8f\uff0c\u8be5\u5904\u7406\u7a0b\u5e8f\u5c06\u4f7f\u7528\u5b83\u4eec\u6765\u9a8c\u8bc1\u5bc6\u7801\u66f4\u6539\u8bf7\u6c42\u3002<\/p>\n<p>\u5728\u7b2c<strong>10-16<\/strong>\u884c\uff0c\u6a21\u677f\u5c06\u6253\u5370\u51fa\u9519\u8bef\uff08\u5982\u679c\u6709\uff09\u3002\u6b64\u4ee3\u7801\u4e0e\u672c\u6559\u7a0b\u524d\u9762\u7684\u77ed\u4ee3\u7801\u6a21\u677f\u4e2d\u7684\u4ee3\u7801\u5b8c\u5168\u76f8\u540c\u3002<\/p>\n<p>\u8fd9\u4e24\u4e2a\u5b57\u6bb5\u5728<strong>18-25<\/strong>\u884c\u4e2d\u6253\u5370\u51fa\u6765\uff0c\u540e\u9762\u662f\u4e00\u4e9b\u6709\u5173\u9009\u62e9\u826f\u597d WordPress \u5bc6\u7801\u7684\u8bf4\u660e\u4ee5\u53ca\u7528\u4e8e\u63d0\u4ea4 WordPress \u66f4\u6539\u5bc6\u7801\u8868\u5355\u7684\u6309\u94ae\u3002<\/p>\n<p>WordPress \u66f4\u6539\u5bc6\u7801\u8868\u5355\u73b0\u5728\u5e94\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/465\/014\/169375350844355.png\" class=\"aligncenter\" title=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe4\" alt=\"\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\u5bc6\u7801\u91cd\u7f6e\u63d2\u56fe4\" \/><\/p>\n<h3>\u7b2c 3 \u6b65\uff1a\u5904\u7406 WordPress \u91cd\u7f6e\u5bc6\u7801\u64cd\u4f5c<\/h3>\n<p>\u5f53\u7528\u6237\u901a\u8fc7\u5355\u51fb WordPress <strong>\u91cd\u7f6e\u5bc6\u7801<\/strong>\u6309\u94ae\u63d0\u4ea4\u8868\u5355\u65f6\uff0c\u5176\u5185\u5bb9\u5c06\u53d1\u9001\u5230 wp-login.php?action=resetpass\uff0c\u76f8\u540c\u7684 URL\u6211\u4eec\u5728\u4e0a\u9762\u4f7f\u7528\u4e86\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u6211\u4eec\u7684\u81ea\u5b9a\u4e49\u5bc6\u7801\u91cd\u7f6e\u9875\u9762\u3002 <\/p>\n<p>\u5f53\u7136\uff0c\u5f53\u6211\u4eec\u81ea\u5df1\u521b\u5efa\u8868\u5355\u65f6\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e0d\u540c\u7684 URL\u3002\u4f46\u662f\uff0c\u901a\u8fc7\u4fdd\u7559\u6b64\u9ed8\u8ba4 URL \u5e76\u4f7f\u7528 login_form_resetpass \uff08\u548c login_form_rp\uff0c\u53ea\u662f\u4e3a\u4e86\u786e\u5b9a\uff09\u64cd\u4f5c\u6765\u66ff\u6362\u9ed8\u8ba4\u529f\u80fd\uff0c\u6211\u4eec\u53ef\u4ee5\u786e\u4fdd\u6ca1\u6709\u4eba\u610f\u5916\u7ed3\u675f\u8c03\u7528\u9ed8\u8ba4\u7248\u672c\u7684\u5bc6\u7801\u91cd\u7f6e\u3002<\/p>\n<p>\u4e3a\u6b64\uff0c\u8bf7\u518d\u6b21\u5411\u6784\u9020\u51fd\u6570\u6dfb\u52a0\u4e24\u884c\uff1a<\/p>\n<pre>add_action( 'login_form_rp', array( $this, 'do_password_reset' ) );\nadd_action( 'login_form_resetpass', array( $this, 'do_password_reset' ) );\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u521b\u5efa\u51fd\u6570\uff1a<\/p>\n<pre>\/**\n * Resets the user's password if the password reset form was submitted.\n *\/\npublic function do_password_reset() {\n    if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {\n        $rp_key = $_REQUEST['rp_key'];\n        $rp_login = $_REQUEST['rp_login'];\n\n        $user = check_password_reset_key( $rp_key, $rp_login );\n\n        if ( ! $user || is_wp_error( $user ) ) {\n            if ( $user &amp;amp;&amp;amp; $user-&amp;gt;get_error_code() === 'expired_key' ) {\n                wp_redirect( home_url( 'member-login?login=expiredkey' ) );\n            } else {\n                wp_redirect( home_url( 'member-login?login=invalidkey' ) );\n            }\n            exit;\n        }\n\n        if ( isset( $_POST['pass1'] ) ) {\n            if ( $_POST['pass1'] != $_POST['pass2'] ) {\n                \/\/ Passwords don't match\n                $redirect_url = home_url( 'member-password-reset' );\n\n                $redirect_url = add_query_arg( 'key', $rp_key, $redirect_url );\n                $redirect_url = add_query_arg( 'login', $rp_login, $redirect_url )\n                $redirect_url = add_query_arg( 'error', 'password_reset_mismatch', $redirect_url );\n\n                wp_redirect( $redirect_url );\n                exit;\n            }\n\n            if ( empty( $_POST['pass1'] ) ) {\n                \/\/ Password is empty\n                $redirect_url = home_url( 'member-password-reset' );\n\n                $redirect_url = add_query_arg( 'key', $rp_key, $redirect_url );\n                $redirect_url = add_query_arg( 'login', $rp_login, $redirect_url );\n                $redirect_url = add_query_arg( 'error', 'password_reset_empty', $redirect_url );\n\n                wp_redirect( $redirect_url );\n                exit;\n            }\n\n            \/\/ Parameter checks OK, reset password\n            reset_password( $user, $_POST['pass1'] );\n            wp_redirect( home_url( 'member-login?password=changed' ) );\n        } else {\n            echo \"Invalid request.\";\n        }\n\n        exit;\n    }\n}\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u51fd\u6570\u9996\u5148\u68c0\u67e5\u8bf7\u6c42\u65b9\u6cd5\uff0c\u5e94\u8be5\u662f POST; GET \u8bf7\u6c42\u5df2\u88ab\u4e0a\u9762\u7684\u91cd\u5b9a\u5411\u51fd\u6570\u5904\u7406\u3002 <\/p>\n<p>\u7136\u540e\uff0c\u5b83\u4ece\u8868\u5355\u6570\u636e\u4e2d\u6536\u96c6\u5bc6\u94a5\u548c\u767b\u5f55\u53c2\u6570\uff0c\u5e76\u4f7f\u7528\u5b83\u4eec\u6765\u9a8c\u8bc1<strong>\u7b2c 9 \u884c<\/strong>\u4e0a\u7684\u5bc6\u7801\u91cd\u7f6e\u94fe\u63a5\uff0c\u4f7f\u7528 WordPress \u51fd\u6570 check_password_reset_key \uff08\u6211\u4eec\u5df2\u7ecf\u5728\u91cd\u5b9a\u5411\u51fd\u6570\u4e2d\u4f7f\u7528\u4e86\u76f8\u540c\u7684\u51fd\u6570\uff09\u3002<\/p>\n<p>\u5728 \u7b2c 10-18 \u884c \u4e2d\uff0c\u6211\u4eec\u518d\u6b21\u68c0\u67e5\u5bc6\u7801\u91cd\u7f6e\u5bc6\u94a5\u68c0\u67e5\u4e2d\u53ef\u80fd\u5b58\u5728\u7684\u9519\u8bef\uff0c\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230<strong>\u5fd8\u8bb0\u5bc6\u7801\uff1f<\/strong>\u6d88\u606f\u6a21\u677f\u9875\u9762\u8fdb\u884c\u6e32\u67d3\u7684\u9519\u8bef\u3002 <\/p>\n<p>\u7136\u540e\uff0c\u5982\u679c\u91cd\u7f6e\u5bc6\u94a5\u6709\u6548\uff0c\u6211\u4eec\u53ef\u4ee5\u4e13\u6ce8\u4e8e WordPress \u5e10\u6237\u6062\u590d\u8868\u5355\u3002 <\/p>\n<p>\u9996\u5148\uff0c\u8be5\u51fd\u6570\u68c0\u67e5\u4e24\u4e2a\u5bc6\u7801\u662f\u5426\u5339\u914d\uff08<strong>\u7b2c 21-31 \u884c<\/strong>\uff09\uff0c\u7136\u540e\u68c0\u67e5\u5b83\u4eec\u662f\u5426\u4e3a\u7a7a\uff08<strong>\u7b2c 33-43 \u884c<\/strong>\uff09\u3002\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\uff0c\u7528\u6237\u90fd\u4f1a\u88ab\u91cd\u5b9a\u5411\u56de\u6211\u4eec\u7684\u5bc6\u7801\u91cd\u7f6e\u9875\u9762\uff0cURL \u4e2d\u5305\u542b key \u548c login \u53c2\u6570\uff0c\u8ba9\u7528\u6237\u91cd\u8bd5\u5bc6\u7801\u66f4\u65b0\u3002 p&gt; <\/p>\n<p>\u6700\u540e\uff0c\u5982\u679c\u6240\u6709\u68c0\u67e5\u5747\u6210\u529f\uff08\u5982\u679c\u60a8\u613f\u610f\uff0c\u53ef\u4ee5\u968f\u610f\u6dfb\u52a0\u66f4\u591a\u68c0\u67e5\uff09\uff0c\u8be5\u51fd\u6570\u5c06\u4f7f\u7528\u51fd\u6570 reset_password \u91cd\u7f6e WordPress \u5bc6\u7801\uff08\u4f4d\u4e8e <strong>\u7b2c 46 \u884c<\/strong>\uff09 \uff09\u5e76\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u767b\u5f55\u9875\u9762\uff0c\u5e76\u5c06\u53c2\u6570 password=changed \u9644\u52a0\u5230 URL \u4ee5\u663e\u793a\u901a\u77e5\u3002 <\/p>\n<p>WordPress \u5bc6\u7801\u73b0\u5df2\u6210\u529f\u66f4\u65b0\uff0c\u5269\u4e0b\u7684\u5c31\u662f\u663e\u793a\u6210\u529f\u901a\u77e5\u5e76\u6dfb\u52a0\u9519\u8bef\u6d88\u606f\u3002<\/p>\n<p>\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u6dfb\u52a0\u901a\u77e5\u3002\u5728\u77ed\u4ee3\u7801\u51fd\u6570 render_login_form \u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u68c0\u67e5\uff1a<\/p>\n<pre>\/\/ Check if user just updated password\n$attributes['password_updated'] = isset( $_REQUEST['password'] ) &amp;amp;&amp;amp; $_REQUEST['password'] == 'changed';\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u5728\u6e32\u67d3\u8868\u5355\u4e4b\u524d\u5c06\u5b9e\u9645\u6d88\u606f\u6dfb\u52a0\u5230\u6a21\u677f login_form.php\uff1a<\/p>\n<pre>&lt;?php if ( $attributes['password_updated'] ) : ?&gt;&lt;p class=\"login-info\"&gt;\n        &lt;?php _e( 'Your password has been changed. You can sign in now.', 'personalize-login' ); ?&gt;&lt;\/p&gt;\n&lt;?php endif; ?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7531\u4e8e\u6211\u4eec\u5df2\u7ecf\u6dfb\u52a0\u4e86\u5bf9\u5448\u73b0\u4e0a\u8ff0\u9519\u8bef\u6d88\u606f\u7684\u652f\u6301\uff0c\u5269\u4e0b\u7684\u5c31\u662f\u5c06\u63cf\u8ff0\u6027\u9519\u8bef\u6d88\u606f\u6dfb\u52a0\u5230\u6211\u4eec\u7684\u51fd\u6570 get_error_message \u4e2d\u3002 <\/p>\n<p>\u5728 switch&#8230;case \u6784\u9020\u4e2d\u7684 default \u5206\u652f\u4e4b\u524d\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>\/\/ Reset password\n\ncase 'expiredkey':\ncase 'invalidkey':\n    return __( 'The password reset link you used is not valid anymore.', 'personalize-login' );\n\ncase 'password_reset_mismatch':\n    return __( \"The two passwords you entered don't match.\", 'personalize-login' );\n    \ncase 'password_reset_empty':\n    return __( \"Sorry, we don't accept empty passwords.\", 'personalize-login' );\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>\u5c31\u662f\u8fd9\u6837\uff01\u91cd\u7f6e WP \u5bc6\u7801\u529f\u80fd\u5df2\u51c6\u5907\u5c31\u7eea\uff0c\u56e0\u6b64\u6211\u4eec\u73b0\u5728\u5df2\u7ecf\u5b8c\u6210\u4e86 WordPress \u767b\u5f55\u4f53\u9a8c\u7684\u81ea\u5b9a\u4e49\uff0c\u4ece\u6ce8\u518c\u65b0\u7528\u6237\u5230\u767b\u5f55\u5e76\u91cd\u7f6e\u4e22\u5931\u7684\u5bc6\u7801\u3002<\/p>\n<p>\u6211\u5e0c\u671b\u672c\u7cfb\u5217\u4e3a\u60a8\u63d0\u4f9b\u4e86\u8db3\u591f\u7684\u5de5\u5177\uff0c\u4ee5\u4fbf\u60a8\u80fd\u591f\u66f4\u597d\u5730\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u81ea\u5b9a\u4e49\uff08\u4f8b\u5982\uff0c\u901a\u8fc7\u5411\u5bc6\u7801\u91cd\u7f6e\u6d41\u7a0b\u6dfb\u52a0\u65b0\u6b65\u9aa4\uff09\uff0c\u5e76\u66f4\u597d\u5730\u4e86\u89e3 wp-login.php \u5185\u90e8\u53d1\u751f\u7684\u60c5\u51b5\u3002 <\/p>\n<p>\u73b0\u5728\uff0c\u53bb\u5b9a\u5236\u66f4\u591a\u5185\u5bb9\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6784\u5efa\u81ea\u5b9a\u4e49\u7684WordPress\u7528\u6237\u6d41\u7a0b\uff0c\u7b2c\u4e09\u90e8\u5206\uff1a\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>\u5728\u672c\u7cfb\u5217\u7684\u524d\u4e24\u4e2a\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u6784\u5efa\u4e86\u7528\u4e8e\u767b\u5f55\u548c\u6ce8\u518c\u65b0\u7528\u6237\u7684\u81ea\u5b9a\u4e49\u9875\u9762\u3002\u73b0\u5728\uff0c\u767b\u5f55\u6d41\u7a0b\u4e2d\u53ea\u5269\u4e0b\u4e00\u4e2a\u90e8\u5206\u9700\u8981\u63a2\u7d22\u548c\u66ff\u6362\uff1a\u5982\u679c\u7528\u6237\u5fd8\u8bb0\u5bc6\u7801\u5e76\u60f3\u8981\u91cd\u7f6e \u5bc6\u7801\uff0c\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f \u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u89e3\u51b3\u6700\u540e\u4e00\u6b65\u5e76\u5b8c\u6210\u6211\u4eec\u5728\u6574\u4e2a\u7cfb\u5217\u4e2d\u6784\u5efa\u7684\u4e2a\u6027\u5316\u767b\u5f55\u63d2\u4ef6\u3002 WordPress \u4e2d\u7684\u529f\u80fd\u6216\u591a\u6216\u5c11\u9075\u5faa\u5f53\u4eca\u7f51\u7ad9\u4e0a\u7684\u6807\u51c6\u65b9\u6cd5\uff1a \u7528\u6237\u901a\u8fc7\u8f93\u5165\u7528\u6237\u540d\u6216\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u5e76\u8bf7\u6c42 WordPress \u91cd\u7f6e\u5bc6\u7801\u6765\u542f\u52a8\u91cd\u7f6e\u3002 \u521b\u5efa\u4e34\u65f6\u5bc6\u7801\u91cd\u7f6e\u4ee4\u724c\u5e76\u5c06\u5176\u5b58\u50a8\u5728\u7528\u6237\u6570\u636e\u4e2d\u3002\u5305\u542b\u6b64\u4ee4\u724c\u7684\u94fe\u63a5\u5c06\u53d1\u9001\u5230\u7528\u6237\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002 \u7528\u6237\u70b9\u51fb\u94fe\u63a5\u3002 \u5728\u91cd\u7f6e\u5bc6\u7801\u9875\u9762\u4e0a\uff0c\u4ee4\u724c\u4f1a\u7ecf\u8fc7\u9a8c\u8bc1\uff0c\u5982\u679c\u5b83\u4e0e\u7528\u6237\u7684\u6570\u636e\u5339\u914d\uff0c\u4ed6\u4eec\u5c31\u53ef\u4ee5\u9009\u62e9\u4e00\u4e2a\u65b0\u5bc6\u7801\u3002 \u5c31\u50cf\u767b\u5f55\u548c\u65b0\u7528\u6237\u6ce8\u518c\u4e00\u6837\uff0c\u6b64\u529f\u80fd\u662f\u901a\u8fc7 wp-login.php \u5904\u7406\u7684\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u5982\u4f55\u81ea\u5b9a\u4e49\u6b64\u6d41\u7a0b\u7684\u603b\u4f53\u601d\u8def\u73b0\u5728\u5927\u90e8\u5206\u90fd\u662f\u4ee5\u524d\u7684\u6559\u7a0b\u6240\u719f\u6089\u7684\u3002 \u5982\u679c\u60a8\u5c1a\u672a\u9605\u8bfb\u524d\u4e24\u4e2a\u6559\u7a0b\uff0c\u6700\u597d\u4ece\u7b2c 1 \u90e8\u5206\u5f00\u59cb\u5e76\u6309\u987a\u5e8f\u6d4f\u89c8\u8be5\u7cfb\u5217\u3002\u60a8\u53ef\u4ee5\u6309\u7167\u6559\u7a0b\u81ea\u884c\u7f16\u5199\u4ee3\u7801\uff0c\u4e5f\u53ef\u4ee5\u4ece\u94fe\u63a5\u7684 GitHub \u5b58\u50a8\u5e93\u4e0b\u8f7d\u5b8c\u6574\u7684\u6e90\u4ee3\u7801\u3002 \u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u5f00\u59cb\u66ff\u6362\u6d41\u7a0b\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5c4f\u5e55\u3002 \u542f\u52a8 WordPress \u91cd\u7f6e\u5bc6\u7801 \u5f53\u7528\u6237\u5230\u8fbe\u60a8\u7684\u767b\u5f55\u9875\u9762\u4f46\u4e0d\u8bb0\u5f97\u4ed6\u4eec\u5728\u8be5\u7f51\u7ad9\u4e0a\u4f7f\u7528\u7684\u5bc6\u7801\u65f6\uff0c\u5c31\u4f1a\u5f00\u59cb\u91cd\u7f6e WP \u5bc6\u7801\u3002 \u4e3a\u6b64\uff0c\u6211\u4eec\u5728\u672c\u7cfb\u5217\u7b2c\u4e00\u90e8\u5206\u7684\u767b\u5f55\u8868\u5355\u5e95\u90e8\u653e\u7f6e\u4e86\u4e00\u4e2a\u5fd8\u8bb0\u5bc6\u7801\uff1f\u6d88\u606f\u6a21\u677f\u94fe\u63a5\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5728 WordPress \u652f\u6301\u7684\u7f51\u7ad9\u4e0a\uff0c\u6b64\u94fe\u63a5\u6307\u5411 wp-login.php?action=lostpassword\uff0c\u9875\u9762\u5982\u4e0b\u6240\u793a\uff1a \u8981\u5c06\u6b64\u9875\u9762\u66ff\u6362\u4e3a\u81ea\u5b9a\u4e49\u9875\u9762\uff0c\u6211\u4eec\u5c06\u521b\u5efa\u4e00\u4e2a\u51fd\u6570\u6765\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230\u6211\u4eec\u7684\u81ea\u5b9a\u4e49\u9875\u9762\uff0c\u5e76\u5c06\u8be5\u51fd\u6570\u6302\u94a9\u5230 WordPress \u64cd\u4f5c\u3002 \u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u6709\u4e24\u4e2a\u9009\u9879\u53ef\u4f9b\u9009\u62e9\uff1a\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u64cd\u4f5c lost_password\uff0c\u8be5\u64cd\u4f5c\u5728\u9875\u9762\u6e32\u67d3\u4e4b\u524d\u8c03\u7528\uff0c\u6216\u8005\u6211\u4eec\u5728\u4e4b\u524d\u7684\u6559\u7a0b\u4e2d\u4f7f\u7528\u7684\u64cd\u4f5c\uff1a login_form_{action}\uff0c\u8fd9\u6b21\u662flogin_form_lostpassword\u3002 \u6211\u4eec\u53ef\u4ee5\u91c7\u53d6\u4e24\u79cd\u65b9\u6cd5\uff0c\u4f46\u4e3a\u4e86\u9650\u5236\u6267\u884c\u7684\u4e0d\u5fc5\u8981\u4ee3\u7801\u7684\u6570\u91cf\uff0c\u8ba9\u6211\u4eec\u9009\u62e9\u540e\u4e00\u4e2a\u9009\u9879\u3002 \u4f46\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u521b\u5efa\u65b0\u7684 WordPress \u81ea\u5b9a\u4e49\u5bc6\u7801\u91cd\u7f6e\u9875\u9762\uff1a \u7b2c 1 \u6b65\uff1a\u521b\u5efa\u91cd\u7f6e\u5bc6\u7801\u9875\u9762 p&gt; \u6b63\u5982\u60a8\u6240\u8bb0\u5f97\u7684\uff0c\u5728\u7b2c 1 \u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 plugin_activated \u56de\u8c03\u51fd\u6570\u521b\u5efa\u4e86\u4e00\u4e2a\u5728\u63d2\u4ef6\u6fc0\u6d3b\u65f6\u521b\u5efa WordPress \u9875\u9762\u7684\u51fd\u6570\u3002 \u5728\u6b64\u51fd\u6570\u4e2d\uff0c\u5c06\u65b0\u9875\u9762\u7684\u5b9a\u4e49\u6dfb\u52a0\u5230 $page_definitions \u6570\u7ec4\u7684\u672b\u5c3e\u3002\u5728 WordPress [&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-32613","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32613","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=32613"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32613\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=32613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=32613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=32613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}