Moving from one host to another – cannot access the dashboard
Changing the AUTH_SALT (and SECURE_AUTH_SALT) from your wp-config.php should fix it
Changing the AUTH_SALT (and SECURE_AUTH_SALT) from your wp-config.php should fix it
It depends on where your login script is. This is my testscript (saved as ìndex.php`): <html> <head> <title>Testform</title> </head> <body> <?php require_once ‘../wp-load.php’; var_dump($_COOKIE); if ( !( current_user_can(‘level_0′) ) ){ wp_login_form(); } else { ?> <ul> <li><a href=”https://wordpress.stackexchange.com/questions/58764/<?php echo home_url(“/wp-admin/’); ?>”>Admin</a></li> <li><a href=”<?php echo wp_logout_url( get_permalink() ); ?>”>Logout</a></li> </ul> <?php } ?> </body> I installed … Read more
There’s this basic trick: Close brackets, open again, insert what you need, close again. Real life example: $args = array( // some args for the login form ‘value_username’ => ‘User Name” onBlur=”whatever” onFocus=”anotherfoo’; ); wp_login_form( $args ); So we closed the brackets after the Username, then added our additional attributes and left the quotes open … Read more
Why do you not use the default function wp_login_form() for the login form, example: global $user_login; if (is_user_logged_in()) { echo __( ‘Hello’, ‘theme_text_domain’ ) . $user_login . ‘<a href=”‘ . wp_logout_url() . ‘” title=”‘ . __( ‘Logout’, ‘theme_text_domain’ ) . ‘”>’ . __( ‘Logout’, FB_BASIS_TEXTDOMAIN ) . ‘</a>’; } else { wp_login_form(); } the function … Read more
Successful log-ins trigger the action wp_login, failures wp_login_failed. Phone calls are not built-in, you need a separate plugin for that. Example with email: add_action( ‘wp_login_failed’, ‘wpse_79917_login_failed’ ); add_action( ‘wp_login’, ‘wpse_79917_login_success’, 10, 2 ); function wpse_79917_login_failed( $username ) { wp_mail( get_option( ‘admin_email’), ‘Login failed’, ‘custom message’ ); } function wpse_79917_login_success( $user_login, $user ) { wp_mail( get_option( … Read more
You have to edit your redirect function to redirect back to the post where you were before redirection add_action( ‘template_redirect’, ‘login_to_see_content’ ); function login_to_see_content() { if ( is_singular() && ! is_user_logged_in() ) auth_redirect(); // does nothing for logged in users } to this add_action( ‘template_redirect’, ‘login_to_see_content’ ); function login_to_see_content(){ if(is_singular() && ! is_user_logged_in()){ $url= site_url().”/wp-login.php”; … Read more
You used in_array wrong. There might be some redundancy in your function too(depending on what you’re doing). You could use something like this to redirect your users: add_filter(‘login_redirect’, ‘redirect_previous_page’, 10); function redirect_previous_page(){ global $user; if ( in_array( ‘administrator’, $user->roles ) ) { return admin_url(); } else { return ‘http://localhost/’; //add your link here } }
As said above modifying the core files is a bad idea, by doing so you are opening up security holes and on top of all this you loose the changes made on up-gradation. To do the above you can try the wp_login hook, put the codes in your active theme’s functions.php function after_login() { $current_user … Read more
If you are ready to do this with css, you can do it in the following clean way. Add the following code in the current theme’s functions.php file add_action( ‘login_head’, ‘wpse_121687_hide_login’ ); function wpse_121687_hide_login() { $style=””; $style .= ‘<style type=”text/css”>’; $style .= ‘.login form{ display: none }’; $style .= ‘.login #nav a, .login #backtoblog a … Read more
You can use the login_redirect filter to do this. One of the parameters is $request, which is the URL the user is coming from Use the below in your active theme’s functions.php file to make this work. function wpse126853_redirect_to_request( $redirect_to, $request, $user ) { // instead of using $redirect_to we’re redirecting back to $request return … Read more