Choose which cookies we can use. You can change this at any time from “Cookie settings” in the footer. See our cookie policy for details.

Essential

Needed for the site to work, such as remembering your cookie choices. These can’t be switched off.

Always on
Skip to content
Developer reference

Block Usernames hooks

2 filters and actions, read from the plugin source. Add these in a theme’s functions.php or a Code Snippet.

  • filter

    wpextended/block-usernames/blocked_usernames

    Filter the list of blocked usernames. Allows other plugins or themes to modify the default list of blocked usernames.

    $default_usernames
    (array) The default list of blocked usernames.

    Returns: array Modified list of blocked usernames.

    add_filter( 'wpextended/block-usernames/blocked_usernames', function ( $default_usernames ) {
        return $default_usernames;
    } );
  • filter

    wpextended/block-usernames/ignored_usernames

    Filter the list of ignored usernames. Allows other plugins or themes to specify usernames that should be ignored even if they match the blocked patterns.

    $ignored_usernames
    (array) The list of usernames to ignore.
    $username
    (string) The username being checked.

    Returns: array Modified list of ignored usernames.

    add_filter( 'wpextended/block-usernames/ignored_usernames', function ( $ignored_usernames, $username ) {
        return $ignored_usernames;
    }, 10, 2 );