Link in comments for users that are not login
Hi guys. I want to change the link for not logged in users in the comment section. The current link is linking to the wordpress login page. I am using a custom login and therefore i want to link to that one instead of /wp-admin. Is that possible? The markup is coming from the _action_comment_form_defaults method in the BrizyPro_Content_Placeholders_Comments class. Is there a hook that i can use to change the link url?
-
Hi Daniel,
Thank you for contacting us.
Please try to add this functions.php file to the child theme :
<?php
// Add to child theme file functions.php
add_action( 'comment_form_defaults', function( $args ) {
if ( isset( $args['must_log_in'] ) ) {
$args['must_log_in'] =
'<p class="brz-must-log-in">' .
sprintf(
__( 'You must be <a href="%s">logged in</a> to post a comment.', 'brizy' ),
get_permalink( $changeToYourPostID )
) .
'</p>';
}return $args;
}, 11 );0 -
or , you can try to add this file, we don't know exactly which will work , because we did not test it.
<?php
add_action( 'comment_form_defaults', function( $args ) {
if ( isset( $args['must_log_in'] ) ) {
$args['must_log_in'] = str_replace( wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ), get_permalink( $changeToYourPostID ), $args['must_log_in'] );
}return $args;
}, 11 );
0
Please sign in to leave a comment.
Comments
2 comments