Skip to content

Instantly share code, notes, and snippets.

@cryptexvinci
Last active December 2, 2020 01:52
Show Gist options
  • Save cryptexvinci/7e2ca1a0ba2d845d9eca0bba79dc8279 to your computer and use it in GitHub Desktop.
Save cryptexvinci/7e2ca1a0ba2d845d9eca0bba79dc8279 to your computer and use it in GitHub Desktop.
Login Redirect from Comments
<?php
/**
* Ultimate member - Redirect Comment to UM Login page on “You must be logged in to post a comment”.
* URL: https://wordpress.org/support/topic/email-domain-restriction-at-registration/
*/
// Change Default Comment Login link to UM Login Page.
add_filter( 'comment_form_defaults', 'um_change_login_link' );
if ( ! function_exists( 'um_change_login_link' ) ) {
function 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;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment