简体   繁体   English

是否可以更改WordPress“重置密码形式”?

[英]Is there a hook to change the WordPress “reset password form”?

I was able to change the "lost password form" to: 我可以将“丢失的密码表格”更改为:

// Change html
function html_lostpassword_form(){
    $html = ''; // <input> etc.
}

// Read file
function my_echo_files(){
    $files = '
        <link rel="stylesheet" href="' . get_bloginfo( 'template_directory' ) . '/css/lostpassword.css" />
        <script src="' . get_bloginfo( 'template_directory' ) . '/js/lostpassword.js"></script>
    ';
    echo $files;
}

// Change the lost password form
function my_password_form() {
    // Change html
    $content = ob_get_contents();
    $content = html_lostpassword_form();
    ob_get_clean();
    echo $content;
    // Read file
    my_echo_files();    
}
add_action( 'lostpassword_form', 'my_password_form' );

When I want to change the "lost password form" lostpassword_form is useful, 当我想更改“遗失密码表单”时, lostpassword_form很有用,

Then What should I do to in the case of "reset password form"? 那么在“重置密码表格”的情况下我该怎么办?

It was not possible with resetpassword_form or rp_form . resetpassword_formrp_form

Now, "lost password form" is the page displayed in "example.com/wp-login?action=lostpassword", and "reset password form" is the page displayed in "example.com/wp-login?action=rp". 现在,“遗失密码表”是在“ example.com/wp-login?action=lostpassword”中显示的页面,而“重置密码表”是在“ example.com/wp-login?action=rp”中显示的页面。 。

You probably mean resetpass_form action hook. 您可能是说resetpass_form操作钩子。 Here is the description . 这是说明

When searching for hooks, you can use the code reference . 搜索挂钩时,可以使用代码参考 Similar hooks are usually located in the same file, so you can find them easily. 相似的挂钩通常位于同一文件中,因此您可以轻松找到它们。 Eg search for "lostpassword_form", then follow it's source file link ( wp-login.php in this case). 例如,搜索“ lostpassword_form”,然后跟随其源文件链接(在这种情况下为wp-login.php )。 And then use a filter in the top of the page to show all action hooks in this file. 然后使用页面顶部的过滤器显示此文件中的所有操作挂钩。 Then you can open hook page and even check the "view on track" link to see how it is used in code directly. 然后,您可以打开挂钩页面,甚至可以查看“按轨查看”链接,以查看如何直接在代码中使用它。

Note that WP has a huge legacy. 请注意,WP具有巨大的遗产。 This means that names of some functions and hooks are not very intuitive sometimes and may slightly differ from that you expect. 这意味着某些功能和钩子的名称有时不是很直观,可能与您期望的略有不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM