I set wp_set_auth_cookie but wp_validate_auth_cookie returns false

If you want the login works without having to reload the page (or redirect to somewhere on the site), then you would want to immediately set both the auth and logged-in cookies, i.e. set them in the superglobal $_COOKIE array. And you can do that via the set_auth_cookie and set_logged_in_cookie hooks: add_action( ‘set_auth_cookie’, function ( … Read more

Create a fullwidth dashboard widget

Here’s perhaps a little hacky way to achieve a full width dashboard widget. Here we force the first (left-most) column to be 100% and to contain our custom widget. Step 1 WP stores the Dashboard widget visibility and order as user specific option. To get the below code working we need to prevent the user’s … Read more

https://mydomain/wp-admin redirects to wp-login.php?redirect_to=https%3A%2F%2Fmydomain%2Fwp-admin%2F&reauth=1

It’s possible to redirect to any page of your site by using the ‘init’ hook. Here’s an example code to show how it can be done. add_action(‘init’, ‘wpse388876_redirect_to_home_page’); function wpse388876_redirect_to_home_page() { global $pagenow; if (‘wp-login.php’ == $pagenow && (!is_user_logged_in() || !is_super_admin() || !is_admin())) { $redirect_to = home_url(); wp_safe_redirect($redirect_to); exit; } } All non-logged in users … Read more

Where are the admin notifications stored?

Where are the admin notifications stored? They aren’t. Admin notices have no storage unless you implement it yourself for your plugin/theme. WordPress provides hooks and styling for displaying admin notices, but that’s it. It might provide styling for dismissible admin notices but it provides no storage or registration mechanisms for persistence. And when a user … Read more