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!
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/'); }
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; }
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!