' . nl2br( esc_html( $custom ) ) . '

'; } /** * Hide "← Go to site". * * @param string $link Link HTML. * @return string */ public function maybe_hide_back_to_site( $link ) { return self::get( 'hide_back_to_site', 0 ) ? '' : $link; } /** * Core prints the link's `

` wrapper regardless; hide * it too so no empty gap is left. * * @return void */ public function maybe_hide_back_to_site_wrapper(): void { if ( self::get( 'hide_back_to_site', 0 ) ) { wp_add_inline_style( 'login', '#backtoblog{display:none;}' ); } } /** * Hide the language switcher. * * @param bool $display Whether to show it. * @return bool */ public function maybe_hide_language_switcher( $display ) { return self::get( 'hide_language_switcher', 0 ) ? false : $display; } /** * Hide the privacy policy link -- on wp-login.php only. * * @param string $link Link HTML. * @return string */ public function maybe_hide_privacy_link( $link ) { return self::get( 'hide_privacy_link', 0 ) && did_action( 'login_init' ) ? '' : $link; } /** * Hide "Lost your password?". * * @param string $link Link HTML. * @return string */ public function maybe_hide_lost_password_link( $link ) { return self::get( 'hide_lost_password_link', 0 ) ? '' : $link; } /** * Hide the "Register" link (registration itself stays open if * Settings → General → Membership allows it). * * @param string $link Link HTML. * @return string */ public function maybe_hide_register_link( $link ) { return self::get( 'hide_register_link', 0 ) && did_action( 'login_init' ) ? '' : $link; } /** * Tick "Remember Me" by default. * * @return void */ public function maybe_tick_remember_me(): void { if ( ! self::get( 'remember_me_checked', 0 ) || 'login' !== Texts::current_screen() ) { return; } wp_print_inline_script_tag( 'document.addEventListener("DOMContentLoaded",function(){var r=document.getElementById("rememberme");if(r){r.checked=true;}});' ); } /** * Send users to a chosen page after logging in -- unless the login link * itself asked for a specific page (e.g. a protected page they tried * to open). * * @param string $redirect_to Destination so far. * @param string $requested The `redirect_to` the login form carried. * @param WP_User|\WP_Error $user The user (or an error). * @return string */ public function login_redirect( $redirect_to, $requested, $user ) { $custom = trim( (string) self::get( 'login_redirect', '' ) ); if ( '' === $custom || ! $user instanceof WP_User ) { return $redirect_to; } if ( '' !== (string) $requested && admin_url() !== (string) $requested && admin_url( '/' ) !== (string) $requested ) { return $redirect_to; } return wp_validate_redirect( $custom, $redirect_to ); } /** * Send users to a chosen page after logging out, unless the logout * link asked for one. * * @param string $redirect_to Destination so far. * @param string $requested The requested destination. * @return string */ public function logout_redirect( $redirect_to, $requested ) { $custom = trim( (string) self::get( 'logout_redirect', '' ) ); if ( '' === $custom || '' !== (string) $requested ) { return $redirect_to; } return wp_validate_redirect( $custom, $redirect_to ); } }