How to correctly escape an echo

Escaping is only necessary when you have no full control of the the thing you are echoing. So as long as $folder is a variable that you have defined yourself, there’s no real need to escape. But if there is user input involved, there is esc_html, to be used as follows: echo esc_html (“this input … Read more

Login page too many redirects

Try this if ( is_user_logged_in() && !is_admin()) { lvkg_redirect_logged_in_user(); exit; } !is_admin() will make sure that this function is not called if a user is already in wp-admin or has been successfully redirected to wp-admin. Without this check after every redirection to wp-admin, this function will be called again lvkg_redirect_logged_in_user(); hence creating an infinite loop.