admin管理员组文章数量:1414604
Can you better explain the operation of this line of code and how can I set the password recovery link to 60 minutes?
$expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS );
Thanks a lot to those who will help me.
Can you better explain the operation of this line of code and how can I set the password recovery link to 60 minutes?
$expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS );
Thanks a lot to those who will help me.
Share Improve this question asked Sep 1, 2019 at 6:41 Matteo FeduziMatteo Feduzi 291 silver badge9 bronze badges1 Answer
Reset to default 0in general we use WordPress filters to make changes for data. so in this code the filter password_reset_expiration
allows us to make changes in it's parameter DAY_IN_SECONDS
which equals 86400 seconds
.
so we can change this value by adding a function that returns a new value to this filter:
add_filter( 'password_reset_expiration', function( $expiration ) {
return MONTH_IN_SECONDS;
});
this function changes the expiration time to be last for one month
we can also change to to any count of seconds
add_filter( 'password_reset_expiration', function( $expiration ) {
return 60; // One minute
});
the upper codes are working in theme functions.php or your plugin files. just be sure to pass an integer for the seconds number
本文标签: passwordexpirationdurationapplyfilters( 39passwordresetexpiration39DAYINSECONDS )
版权声明:本文标题:password - $expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS ); 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745194366a2647064.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论