Hi,
I’m trying to change the login link in the comment section because it redirects to wp-admin instead of the login page (I’m using the plugin Ultimate member). I tried to add some code snippets I found on the forums but nothing works.
Example 1: I tried to remove the link returning nothing if no user is logged in
add_filter( 'comment_reply_link', 'not_ask_for_comment_log_in');
add_filter('post_comments_link', 'not_ask_for_comment_log_in');
function not_ask_for_comment_log_in( $link ){
if (get_option('comment_registration') && !is_user_logged_in() ) {
return '';
}
return $link;
}Example 2: I tried to replace the link
add_filter( 'login_url', 'my_login_linkchanger');
function my_login_linkchanger( $link ) {
return home_url( '/login/');
}Example 3: I have tried to replace it in another way
add_filter( 'login_url', 'my_login_page', 10, 3 );
function my_login_page( $login_url, $redirect, $force_reauth ) {
return home_url( '/login/?redirect_to=' . $redirect );
}Example 4: Another way found in this forum
function um_071921_login_url ( $login_url, $redirect, $force_reauth ) { if( ! function_exists('um_get_core_page') ) return $login_url; return um_get_core_page('login') . '?redirect_to=' . $redirect; } add_filter( 'login_url', 'um_071921_login_url', 10, 3);
Nothing seems to work… Can anyone help me with that? Is there something I’m missing?
Thank you in advance
- This topic was modified 37 minutes ago by .
The page I need help with: [log in to see the link]
