Useful Functions for Sites with Subscribers

If you have you have a lot of user accounts for subscribers (or customers if using WooCommerce or Easy Digital Downloads), you might find these functions useful for blocking access to the dashboard and simplifying logins.

Allow Users to Use Their E-mail Address to Login

Your visitors probably already have a lot of usernames to remember. Why make it harder on them? Allow them to user their e-mail address as a username.

View this code snippet on GitHub.

Disable Admin Bar for Specific Users

Most websites look a lot nicer without that black bar across the top. Hide it for users that can’t edit posts.

View this code snippet on GitHub.

Redirect Users Who Attempt to Access Dashboard

If your users don’t need to access the dashboard, make sure they can’t access it. This code redirects any visitor that doesn’t have permissions to edit posts back to the home page if they attempt to access anything wp-admin.

View this code snippet on GitHub.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *