Your site has a generic account for anonymous users to login to. Line 4 is where you specify the username to login with; the customized code snippet will try to login to the dummy account. The anatomy of the autologin function is identical, except for the fact its code is repeated using the foreach loop for each account. At the moment our snippet is only set up for auto-logging in to one account. IMPORTANT Never use this to login to accounts with real power; eg. On the first line you will see the conditional checking for the URL parameter. For example, on many backend WordPress demos the author will create a demo account for prospective customers to login as and play with his her product.
To add additional accounts simply customise and add as many of the following code blocks as you need. This can either be dropped into your theme s functions file, or can be put in its own plugin file and activated. This is very simple to use. Use this snippet carefully.
This could be useful if;
This snippet is very easy to customise. You want to direct visitors directly to the relevant location eg. At its core this is essentially the same, but with a cheeky foreach loop plus accounts array thrown in as well. This is designed to be used on WordPress sites which offer a generic account for users to login to.
More often than not, the author will simply display a notice saying;. This, if used safely, can be very convenient. Ok, so as I have done in my other tutorials, I ll give you the complete, annotated code first so that those of you who aren t fans of reading can get straight to experimenting with it. The rest of the code should be pretty self-explanatory, but if you have any questions about what I ve done, or why I have done it, just leave a comment below or tweet me. You want a one click login link. This snippet is only a simple function designed for lightweight usage, such as on a product demo site, but does have the potential to be used for much more complex login scenarios.
As you can probably guess, line 7 is where you specify the password. The following snippet has been styled in the form of a standalone plugin my personal preference. Fill these values out and you should be good to go. You should immediately be redirected to wp-admin, logged into the account specified. Have a look below at my solution. The above password is pa55word.
IMPORTANT: Never use this to login to accounts with real power; eg. Administrator/Editor accounts etc. Use this snippet carefully.
If the credentials are wrong though, you should just see the login form as is normal. These values can be whatever you want, but be careful to avoid original WordPress parameters such as loggedout , action and redirect_to. The above code block will be checking for; wp-login. You want to maximize product demo conversion by providing a quick and efficient pathway to the demo, minimizing required steps. All relevant details are now stored in the global array.
On the first line you will see the conditional checking for the URL parameter. The above code block will be checking for; wp-login. php? login=dummy_account
You will also notice I have moved the parameter name to a global variable as well this is not necessary, but I did so simply to remove all hard coded values from the autologin function. USERNAME demo PASSWORD demo. There are essentially only 3 things you will need to edit, and all these changes are to made in the following code block lines 11 to 17 of the complete code. This could be useful if;.
What if we want different login links for different accounts. I will give you a quick snippet to automatically login to the WordPress admin with these credentials. The above example is set up for 2 accounts, but our snippet can accommodate for as many as we need. Surely we can make the demo look slightly more streamlined and professional. Administrator Editor accounts etc. Settings page.
Default empty. head body class login echo esc_attr implode , classes ;. Copy permalink. No definitions found in this file. param string action The action that brought the visitor to the login page. 0 param string errors Login error message. You will receive a link to create a new password via email.
sanitize_html_class strtolower str_replace _ , — , get_locale ; Filters the login page body classes. tabindex -1 bloginfo name ;. div id login h1 a href echo esc_url login_header_url ;. a h1 unset login_header_url , login_header_title ; Filters the message to display above the login form.
‘ . apply_filters ( ‘login_messages’ , $ messages ) . «
0 param array classes An array of body classes. function login_header title Log In , message , wp_error global error , interim_login , action ; Don t index any of these forms add_action login_head , wp_no_robots ; add_action login_head , wp_login_viewport_meta ; if empty wp_error wp_error new WP_Error ; Shake it. login_header_url apply_filters login_headerurl , login_header_url ; Filters the title attribute of the header logo above login form. ; charset bloginfo charset ;.
Default Log In. apply_filters login_messages , messages. __ Register For This Site. __ Enter your new password below. script if sessionStorage in window catch e ; script Enqueue scripts and styles for the login page. 0 do_action login_enqueue_scripts ; Fires in the login page header after scripts are enqueued.
org 1999 xhtml language_attributes ;. error_message. message apply_filters login_message , message ; if. param string title Optional. __ Please enter your username or email address. title echo get_bloginfo name , display.
require dirname __FILE__. 0 param string message Login message text. title wp_enqueue_style login ; Remove all stored post data on logging out. Fires in the login page header after the body tag is opened. 0 param string login_header_title Login header logo title attribute.
‘ . __ ( ‘Register For This Site’ ) . ‘
n ; In case a plugin uses error rather than the wp_errors object if. n ; else errors. 0 do_action login_header ;. _SERVER REQUEST_URI ; exit ; Output the login page header.
Copy permalink. style type text css html style if success interim_login classes interim-login-success ; classes locale-. like wp_shake_js , but maybe better if it s not removable by plugins if loggedout wp_error — get_error_code. Default empty. shake_error_codes array empty_password , empty_email , invalid_email , invalidcombo , empty_username , invalid_username , incorrect_password ; Filters the error codes array for shaking the login form. Go to definition R.
Under Cookies, click on the All Cookies and Site Data button. I am having some difficulty logging into my WordPress site. php will show you exactly what table has crashed if this is the case. Afterwards I was still not able to log in normally. If I visit example. I was able to log in w Chrome incognito. What did the trick was logging in via incognito mode first, and then I was able to login normally.
19 Answers 19
I also had this issue but had a different message. php I was still stuck. 1 salt thanks Josh Rodgers. There are many possible causes to this problem.
Under Cookies, click on the “All Cookies and Site Data” button
Hopefully soon WP developers will fix this issue. clearing the cookies didn t do the trick. Any tips on how to fix this would be greatly appreciated. No luck with clearing cache,.
Please help as I urgently need to update content on the site. I went into PhpMyAdmin wp_usermeta and deleted the meta_value for session_token. htaccess, DB session clearing, ftp disabling plugins etc. Browser cache alone did not work, I had to specifically delete all cookies related to the domain. Under Privacy Settings, click on the Content Settings button. It turned out to be the database itself being oversize and then blocked by the shared hosting.
Had the same problem. Some have to do with your database. just exit out of Incognito mode by closing the window. Try turning on WP_DEBUG and interpreting the error messages. Changing blog to blog fixes the problem. Click Done and try to login to your site again in Normal mode.
Then Search for your website by a keyword in the search box Highlight your website and click Delete on your keyboard. this happened to my when I upgraded my website to php v7. I have found numerous forum posts about the issue but none offer a satisfactory solution. For some reason they were empty. If you already had the site open in another tab, you ll get a cookie error.
I am having some difficulty logging into my WordPress site. When I attempt to visit example. com/wp-admin, I see a blank page and the url bar changes to:
Unfortunately, I don t know how to keep the version and fix the issue. downgrading to php 7. Just went through this same thing. Setting define WP_DEBUG , true ; in the wp-config.
This could be caused by a wordpress table crashing. I resolved this problem by defining security keys in wp-config. When I attempt to visit example. In my own case which is how I stumbled on your question here , the problems was writing a session token into usermeta. Settings Show Advanced Settings Content Settings. Thought this might help someone else completely stuck after trying every other suggested option.