Home > CMS Tutorial > WordPress > body text

How to customize WordPress login to reply with links and text

藏色散人
Release: 2020-06-29 13:22:23
forward
2822 people have browsed it

The following column WordPress Tips will introduce to you how to customize WordPress login to reply to links and text. I hope it will be helpful to friends in need!

How to customize WordPress login to reply with links and text

By default, "Users must be registered and logged in to post comments" is turned on, and the normal reply button will change to "Log in to reply" and link to WordPress login Page, if you want to customize the link to a specified page, such as the front-end login page and customize the text, you can achieve this through the following code.

Customize Wordpress Log in to reply with links and text

Add the code to the current theme function template functions.php.

1. Customize the login to reply link

add_filter('login_url','zm_custom_login_url');
 
function zm_custom_login_url($login_url) {
// my-login为自定义链接
return home_url('/my-login/');
}
Copy after login

2. Customize the "Log in to reply" text

add_filter( 'comment_reply_link', 'zm_change_comment_reply_text' );
 
function zm_change_comment_reply_text( $link ) {
// 替换文字
$link = str_replace( '登录以回复', '自定义文字', $link );
return $link;
}
Copy after login

Change the currently displayed text accordingly.

The above is the detailed content of How to customize WordPress login to reply with links and text. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:zmingcx.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!