Created
September 4, 2022 19:35
-
-
Save hamidrezayazdani/c0c302846816624090ca6bbf9bca2630 to your computer and use it in GitHub Desktop.
Redirect Comment to Ultimate member Login page on "You must be logged in to post a comment".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change Default Comment Login link to UM Login Page | |
*/ | |
if ( ! function_exists( 'ywp_um_change_login_link' ) ) { | |
function ywp_um_change_login_link( $defaults ) { | |
if ( class_exists( 'UM' ) ) { | |
$defaults['must_log_in'] = '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), um_get_core_page( 'login' ) ) . '</p>'; | |
return $defaults; | |
} | |
} | |
} | |
add_filter( 'comment_form_defaults', 'ywp_um_change_login_link' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment