Autologin for wordpress

Notice: A non well formed numeric value encountered in /customers/b/b/d/puddinq.com/httpd.www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 118Notice: A non well formed numeric value encountered in /customers/b/b/d/puddinq.com/httpd.www/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 119

At one site I have a custom role that can only view the orders. The owner wants some users to hav access without a password. Yes this story gets dumber.. He wants to give access by clicking a link.

The basic script offered to autologin are hooked in to ‘plugins_loaded’ or ‘wp’. Both these hooks resulted in white screens.. WooCommerce did not like the usercapabilities to switch.

The solution was the ‘init’ hook.

By adding ?code=KKGFJ96DKGHJ979679KJHGK098MGHJGKKG to any url the users gets loged in. You can even use https://www.example-domain.nl/wp-admin/edit.php?code=KKGFJ96DKGHJ979679KJHGK098MGHJGKKG&post_type=shop_order and the user gets redirected to the order page. ( now the link gives access ).