Is it possible to allow a user to select which theme they would like installed from the new site signup page? And once the site is created, it obviously installs whichever theme they chose.

I found wp_get_themes. Is this how you would go about pre-populating a dropdown menu with all the available themes? How do you pass the theme's information to the actual signup process so the site is created with the correct theme?

If someone knows how to do this with Gravity Forms, that would be great also.


Here's what I have so far, it doesn't take into account child themes, will work on that after

This function will output a list of themes with radio buttons, storing the selected theme in $_POST['custom_theme']

* Show list of themes at bottom of wp-signup.php (multisite)
function 70169_add_signup_extra_fields() { ?>

Themes<br />
$themes = wp_get_themes();

foreach ( $themes as $theme ) {
    $theme_name = $theme['Name'];
    $theme_stylesheet = $theme->stylesheet;
        <input id="<?php echo $theme_stylesheet; ?>" type="radio" <?php if ( isset( $_POST['custom_theme'] ) ) checked( $_POST['custom_theme'], $theme_stylesheet ); ?> name="custom_theme" value="<?php echo $theme_stylesheet; ?>" ><?php echo $theme_name; ?>

<?php } ?>

<?php }
add_action( 'signup_extra_fields', '70169_add_signup_extra_fields' );

I thought I'd add a hidden field as a way to pass the theme's value onto the site creation. There's something wrong with this though - at the last step it loses it's value, not sure why yet.

 * Add a hidden field with the theme's value
function 70169_theme_hidden_fields() { ?>

    $theme = isset( $_POST['custom_theme'] ) ? $_POST['custom_theme'] : null;
<input type="hidden" name="user_theme" value="<?php echo $theme; ?>" />
<?php }
add_action( 'signup_hidden_fields', '70169_theme_hidden_fields' );

And finally a function to pass the theme name to the newly created site. This works if I hardcode the variables, but I'm unable to pass the value of the custom_theme yet. The site gets created fine but the template and stylesheet options are blank. It's just not getting the value no matter what I try. I guess I have to use $_GET to access the hidden field I created earlier. Again, all I want to do at this point is pass the same theme name to the template and stylesheet options, I'll figure out how to differentiate them after I get it working.

 * Create the new site with the theme name
function 70169_wpmu_new_blog( $blog_id ) {

// need to get this working, use $_GET?
//    $theme = ???

    update_blog_option( $blog_id, 'template', $theme );  // $theme works if I hardcode it with a theme name
    update_blog_option( $blog_id, 'stylesheet', $theme );

add_action( 'wpmu_new_blog', '70169_wpmu_new_blog' );
  • 1
    I think this is a good question, +1
    – Anh Tran
    Oct 26, 2012 at 5:25
  • 1
    theoretically it is possible by adding additional fields to the registration form, but how would the user know how the themes looks like ? the preview will make the registration process a bit more complicated imho...
    – krembo99
    Oct 26, 2012 at 7:11
  • @krembo99 fair point. I tried to simplify it for the question. I was going to use radio fields with thumbnail previews or have a button on each theme page that said "signup with this theme". The button would simply pass the name of the theme name to the signup form. Thought I'd start out simple :)
    – Andrew
    Oct 26, 2012 at 7:27
  • 1
    ok - in that case, if you really want to do so , see my answer..
    – krembo99
    Oct 27, 2012 at 9:11

4 Answers 4


In order to do what you want , you can add whatever fields you want, and then store them in the user_meta ...

(One could also store them in the $user_info array/object, but I am not sure what would be the benefit .. )

  // Render Form Fields
// Checking
// Insert Data
add_action('user_register', 'k99_register_new_register_fields');

// Render the form with the additional radio field 
function k99_register_form_add_theme_field(){

<label>Theme<br />
 <?php $themes=wp_get_themes();
foreach ($themes as $theme ) {
$theme['Name'] = sanitize_title_with_dashes($theme['Name']);
$checked = checked( $_POST['custom_theme'], 1 );
 echo '<input id="custom_theme'.$theme['Name'] .'" type="radio" name="custom_theme" value="'. $theme['Name'] .'" '.$checked.'>  '. $theme['Name'].'<br />';
$custom_theme = $_POST['custom_theme'];
} ?>


// checking , sanitation etc .. of course this is not done...

function k99_check_fields($login, $email, $errors) {
global $custom_theme;
if ($_POST['custom_theme'] == '') {
$errors->add('empty_theme', "<strong>Error:</strong> Please select theme.");
else {
$custom_theme = $_POST['custom_theme'];

// Write to DB ... if you will..
function k99_register_new_register_fields($user_id, $password="", $meta=array())  {

$custom_theme = $_POST['custom_theme']; //just in case ..
update_usermeta($user_id, 'user_custom_theme',$custom_theme);


after all of that you can retrieve the user_theme like so :

get_user_meta($user_id, 'user_custom_theme', true);

NOTE : This was written On-The-Fly. It was not verified on multi-blog, but on a simple wp installation , and although there should not be much difference - still this is not a production function, it was only to put you on the right track. Sanitation and checking on variables, cleaning code and FORM MARKUP are needed , as well as adding the field also to other user related screens (create user, edit user, edit profile etc..) .

NOTE II: you asked about gravity forms in your uodate - they have an add-on for that

  • thanks for your help. I've managed to piece together something and nearly have it working. Just having trouble getting the hidden field to stick and pass the value onto the last function. Have updated my question to include my progress thus far.
    – Andrew
    Oct 28, 2012 at 4:48
  • did you tried my function ? it should work ..
    – krembo99
    Oct 28, 2012 at 8:39
  • The register_form hook in your example won't work in multisite. Found another hook to add the radio buttons to. Also get_themes() is deprecated and I found a better way to get the theme's information. Finally I don't think adding the theme's name to the user's meta table is the best way, the theme's template and stylesheet are stored in the options table. In saying that, your code has been a tremendous help so far, thanks.
    – Andrew
    Oct 28, 2012 at 9:17
  • the register_form hook will work on multisite (see CODEX codex.wordpress.org/Plugin_API/Action_Reference/register_form) . you can find many other hooks, but that would be the right one to use IMHO.. about the other comments, i do not really understand the point, care to explain ?
    – krembo99
    Oct 28, 2012 at 21:24
  • Thanks for the note on the gravity forms user registration plugin. I have that plugin already but it does not allow you to select a theme when the user registers for a site, hence my question.
    – Andrew
    Oct 28, 2012 at 22:41

I know this is kind of cheating, but I use this plugin. It lets you copy any existing network site and then makes it available as a template when new users sign up. You can create as many new blog templates as you wish. They will contain all content, plugins, setting etc etc and users can choose one when setting up a new site / account :)



This kind of answers your question: We put a plugin called 'Theme Switch' on this site: focusww.com and it put a sidebar where you can choose from a list of themes. It lets you choose which themes may be used and how long before the cookie expires to revert to a default theme.

  • Sorry I'm not after a "theme switcher". I would like the user to be able to select a theme when they signup for a blog using wp-signup.php in a multisite installation.
    – Andrew
    Oct 26, 2012 at 5:14
  • I just stumbled on a $19 plugin that lets users install a theme on registration: premium.wpmudev.org/project/new-blog-template <= check it out :)
    – Nohl
    Nov 7, 2012 at 0:23

If still relevant, maybe this could help others looking for similar solutions

 * Add custom field to registration form
add_action( 'signup_blogform', 'aoc_show_addtional_fields' );
add_action( 'user_register', 'aoc_register_extra_fields' );

function aoc_show_addtional_fields() 
    $themes = wp_get_themes();
    echo '<label>Choose template for your site';
    foreach ($themes as $theme){
        echo '<img src="'.$theme->get_screenshot().'" width="240"/>';
        echo $theme->name . ' <input id="template" type="radio" tabindex="30" size="25" value="'.$theme->template.'" name="template" />';
    echo '</label>';

function aoc_register_extra_fields ( $user_id, $password = "", $meta = array() ) {
    update_user_meta( $user_id, 'template', $_POST['template'] );

// The value submitted in our custom input field needs to be added to meta array as the user might not be created yet.
add_filter('add_signup_meta', 'aoc_append_extra_field_as_meta');
function aoc_append_extra_field_as_meta($meta) 
    if(isset($_REQUEST['template'])) {
        $meta['template'] = $_REQUEST['template'];
    return $meta;

// Once the new site added by registered user is created and activated by user after email verification, update the template selected by user in database.
add_action('wpmu_new_blog', 'aoc_extra_field', 10, 6);
function aoc_extra_field($blog_id, $user_id, $domain, $path, $site_id, $meta) 
    update_blog_option($blog_id, 'template', $meta['template']);
    update_blog_option($blog_id, 'stylesheet', $meta['template']);

I have written a blog post (http://artofcoding.in/select-theme-while-registering-wordpress-multisite-network/) here when I had a similar requirement. Hope this is helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.