简体   繁体   English

wp-login.php WORDPRESS中的查询在哪里

[英]Where is the query in wp-login.php WORDPRESS

I am making a loginform in WORDPRESS and i want to have a validation on it, so i tried to look at the wp-login.php to see how they validate things. 我正在WORDPRESS中制作一个loginform,我想对其进行验证,因此我尝试查看wp-login.php以查看它们如何验证事物。 But i did not find what i am looking for. 但是我没有找到我想要的东西。 I would like to know how they validate things or what input do they need to validate things. 我想知道他们如何验证事物或他们需要什么输入来验证事物。 I tried to search the wordpress forums all i can find is plugin, plugin and more plugin. 我试图搜索wordpress论坛,但我只能找到插件,插件和更多插件。 I dont want a plugin. 我不要插件。 I want to hardcode it. 我想对其进行硬编码。 So please help me. 所以请帮帮我。

  1. I want to know where you can find the part that searches for the users username and password. 我想知道在哪里可以找到搜索用户名和密码的部分。
  2. Or if not , know what is needed for a successful login. 否则,请知道成功登录所需的内容。 example username or password or others. 例如用户名或密码或其他。

by the way here is the wp-login.php . 这里是wp-login.php THanks 谢谢

Indeed the auth logic is not located in wp-login.php . 实际上,auth逻辑不在wp-login.php

Wordpress relies a lot on hooks ( actions and filters ). WordPress在很大程度上依赖于钩子( 动作和过滤器 )。 For authentication, this article explain some of the process in wordpress 2.8+. 对于身份验证, 本文介绍了wordpress 2.8+中的一些过程。 AFAIK this is still the same in 3.x. AFAIK在3.x中仍然相同。

Authentication process is based on the authenticate filter. 身份验证过程基于authenticate过滤器。 Two hooks are added in the filter queue : 在筛选器队列中添加了两个钩子:

  • wp_authenticate_username_password() (priority 20) in wp-includes/user.php (line 68) wp-includes/user.php wp_authenticate_username_password()(优先级20)(第68行)

  • wp_authenticate_cookie() (priority 30) in wp-includes/user.php (line 117) wp-includes/user.php wp_authenticate_cookie()(优先级30)(第117行)

See the article for more details. 请参阅文章以获取更多详细信息。

I encourage you not to hack the core directly but add some hooks on this filter with higher priorities. 我鼓励您不要直接破解内核,而是在此过滤器上添加一些具有更高优先级的钩子。

Start looking on line 535: 开始查看第535行:

case 'login' :
default:
        $secure_cookie = '';
        $interim_login = isset($_REQUEST['interim-login']);

That appears to be the login function. 这似乎是登录功能。 At line 630 you get what appears to be the html for the login form: 在630行,您将看到登录表单的html:

<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
        <p>
                <label for="user_login"><?php _e('Username') ?><br />
                <input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
        </p>

Make your edits and see if that works. 进行修改,看看是否可行。

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

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