Get the App
SLTechnology News&Howtos  ›  Servers  › 

How WordPress customizes login to reply to links and text

Shulou Source: shulou.com Published: 2022-06-02 08:52:23 09月19日 Update

How does WordPress customize login to reply to links and text? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

By default, when "users must register and log in to comment", the normal reply button will change to "login to reply" and link to the WordPress login page. If you want to customize the link to the specified page, such as the front-end login page and customize the text, you can use the following code.

Customize Wordpress login to reply to links and text

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

First, customize login to reply to the link

Add_filter ('login_url','zm_custom_login_url'); function zm_custom_login_url ($login_url) {/ / my-login is the custom link return home_url (' / my-login/');}

Second, customize the text of "login to reply"

Add_filter ('comment_reply_link',' zm_change_comment_reply_text'); function zm_change_comment_reply_text ($link) {/ / replacement text $link = str_replace ('login to reply', 'custom text', $link); return $link;}

Change it accordingly according to the text currently displayed.

This is the answer to the questions about how to customize WordPress login to reply to links and text. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Tags: Login text links questions pages code more help answers easy easy theme content function front end can pass guys buddies situations buttons Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Huawei Shulou Tech Info NVidia Apple