How to restrict usernames in WordPress without a plugin

Here is a snippet that enables you to restrict certain usernames from being created by new users registering to your WordPress website.

Instructions
Add this code your theme function.php file.
*Remember to replace content of the “restricted array” with the usernames you want to restrict.

If you want to use a plugin to achieve the same functionality, you can use Scott Reilly’s Restrict Usernames WordPress plugin.

Comments

One Reply to “How to restrict usernames in WordPress without a plugin”

Leave a Reply

Your email address will not be published. Required fields are marked *

Snippet Info

Tested with Wordpress v. 4.9.5
Last Modified: 16.08.2015
Last Reviewed: 05.09.2018

How to restrict usernames in WordPress without a plugin
5 (100%) 1 vote
Please report broken snippets.
Report Broken Snippet