WordPress.org

Codex

WPMU Functions/wpmu validate blog signup

Contents

Description

Validates the passed blog name and title against set criteria (listed below).

Parameters

$blogname
(string) (required) The blog name to be validated.
Default: None
$blog_title
(string) (required) The blog title to be validated.
Default: None
$user
(object) (optional) Purpose unknown at present.
Default: [blank string]

Validation

Blog name

The function validates that the blog name...

  • Is not already in use
  • Is at least 4 characters long
  • Is not empty
  • Is lowercase
  • Is alphanumeric (contains numbers and letters)
    • It cannot be numeric only (is not only numbers)
    • Does not contain an underscore (the "_" character)
  • Does not contain illegal names defined in Site Admin -> Options
    Defaults: "www", "web", "root", "admin", "main", "invite", "administrator"

Blog title

The function validates that the blog title...

  • Is not empty

Return Values

(WP_Error) 
Instance of WP_Error with error codes and messages inside.

Usage

<?php wpmu_validate_blog_signup($blogname$blog_title$user); ?>

Example

To validate the blog name and title, you would use the following:

<?php

// The URL given to the new blog e.g. newblog.domain.com or  domain.com/newblog
$blog_name    'newblog';

// The title given to the new blog
$blog_title 'New Blog';

$result wpmu_validate_blog_signup($blog_name$blog_title);

?>