WordPress.org

Make WordPress Core

Ticket #13304: reserved_names.patch

File reserved_names.patch, 681 bytes (added by jwriteclub, 4 years ago)

Adds an extra check to 'create_empty_blog'

  • ms-functions.php

     
    320320        if ( empty($path) ) 
    321321                $path = '/'; 
    322322 
     323        // Check if we're in a list of forbidden paths 
     324        $reserved_blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' ); 
     325        if( array_key_exists($path,$reserved_blognames) ) 
     326            return __( 'Error: Forbidden site name.' ); 
     327 
    323328        // Check if the domain has been used already. We should return an error message. 
    324329        if ( domain_exists($domain, $path, $site_id) ) 
    325330                return __( 'Error: Site URL already taken.' );