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
33      if ( ! is_array( $_POST['blog'] ) )
34           wp_die( __( 'Can’t create an empty site.' ) );
35      $blog = $_POST['blog'];
36      $domain = '';
37      if ( ! preg_match( '/(--)/', $blog['domain'] ) && preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) )
38           $domain = strtolower( $blog['domain'] );
39
40      // If not a subdomain install, make sure the domain isn't a reserved word
41      if ( ! is_subdomain_install() ) {
42           $subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) );
43           if ( in_array( $domain, $subdirectory_reserved_names ) )
44                wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: <code>%s</code>' ), implode( '</code>, <code>', $subdirectory_reserved_names ) ) );
45      }
46
47      $email = sanitize_email( $blog['email'] );
48      $title = $blog['title'];
49
50      if ( empty( $domain ) )
51           wp_die( __( 'Missing or invalid site address.' ) );