Is there a way to allow anyone into the admin panel, without the need to log in?

Or, if need be, is there a way to have Wordpress auto-login using a certain set of credentials?

This seems like something that should be trivial, but it appears nobody else has found a use case for this as of yet.

  • Oh, and yes, I am aware of the implications; there really is a valid use-case for this. I promise ;) – Qix - MONICA WAS MISTREATED Oct 24 '14 at 4:26
  • how is it different from simply giving user and password info? maybe there is a use case but right now it is totally not obvious – Mark Kaplun Oct 24 '14 at 5:54
  • @MarkKaplun Because it's an internal tool we're using more as a CMS and less as a blog. For its particular purpose, there's no point for credentials. – Qix - MONICA WAS MISTREATED Oct 24 '14 at 6:01
  • "For its particular purpose, there's no point for credentials" - I am sure this is what they said at target ;). And you didn't really answered my question about why not to give user and password as public info – Mark Kaplun Oct 24 '14 at 6:40
  • This is easily done. You could create a user with a specific WP role. Then hook into the 'authenticate' filter. In the function return the created user. The other component is that you would need to modify the login form so that it is not a form... just a login button or login link. – user42826 Oct 24 '14 at 9:12

Here is example code that will log everyone in as 'autologinuser'. The 'autologinuser' needs to be created and given a role prior to using this code.

function my_autologin() {
    if (!is_user_logged_in()) {
        $uid = 'autologinuser';
        $user = get_userdatabylogin( $uid );
        do_action('wp_login', $user_login);  // optional
| improve this answer | |
  • This doesn't bypass the login form though – Qix - MONICA WAS MISTREATED Oct 24 '14 at 16:13
  • That code above, should work with the WP login form. I believe you should be able to leave the username/password fields empty and click on the submit button. Note that there was a typo that I corrected. I have code that modifies the login form, but it contains our css so it wouldnt be that useful. Would you want me to show you the code, minus css? – user42826 Oct 24 '14 at 16:29
  • Again, the point isn't to modify the login form but instead bypass it altogether. – Qix - MONICA WAS MISTREATED Oct 24 '14 at 16:31
  • 1
    Misunderstood you initially. I updated the code now to autologin users transparently. – user42826 Oct 24 '14 at 16:42
  • There we go :) That's enough to work with. Thank you! – Qix - MONICA WAS MISTREATED Oct 24 '14 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.