Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: subdirectory_reserved_names

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
542      $errors = new WP_Error();
543      $illegal_names = get_site_option( 'illegal_names' );
544      if ( $illegal_names == false ) {
545           $illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
546           add_site_option( 'illegal_names', $illegal_names );
547      }
548
549      // On sub dir installs, Some names are so illegal, only a filter can spring them from jail
550      if (! is_subdomain_install() )
551           $illegal_names = array_merge($illegal_names, apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) ) );
552
553      if ( empty( $blogname ) )
554           $errors->add('blogname', __( 'Please enter a site name.' ) );
555
556      if ( preg_match( '/[^a-z0-9]+/', $blogname ) )
557           $errors->add('blogname', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
558
559      if ( in_array( $blogname, $illegal_names ) == true )
560           $errors->add('blogname',  __( 'That name is not allowed.' ) );