Customizing Text on WordPress’s wp-signup.php Page

So, how does one change the text on the wp-signup.php page? Err, you know, this thing:

The wp-signup.php page

The wp-signup.php page in all its glory.

It’s unfortunately not straightforward since it’s not a themeable page and it’s part of WordPress core, but there’s a way to do it.

I’ve searched and read any number of articles describing how to deal with customizing this page, but most deal with adding CSS using the “signup_header” action which doesn’t solve the problem of changing the text, or creating a copy of wp-signup.php somewhere and doing a redirect to it on the web server which seems to skirt the lines of overkill.

But what if you really wanted to change the text. Like really, really wanted to. What if you use a plugin like Limit Blogs Per User and didn’t want users to see “There is no limit to the number of sites you can have” since that really wouldn’t be appropriate anymore… because, yeah.

I managed to find a quick solution to customizing the text on wp-signup.php or anywhere that uses the WordPress translation functions (e.g. http://codex.wordpress.org/Function_Reference/translate) by running a function during the gettext filter.

It’s kind of a hack but will do until WordPress can address the issue.

So, if you need to change the text on wp-signup.php, give this a try:

/**
* Modify default wp-signup.php text
*/
function themename_wp_signup_text( $translated_text, $untranslated_text, $domain ) {
    global $pagenow;

    if ( is_multisite() && $pagenow === "wp-signup.php" ) {
       if( $untranslated_text === "Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!") {
               $translated_text = __( "Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. You can create a maximum of 5 sites.", "theme_text_domain" );
       }
    }
    return $translated_text;
}
add_filter( "gettext", "themename_wp_signup_text", 20, 3 );

Every string of text sent through a translation function (in this case __()) goes through the gettext filter. See what’s going on here is when the gettext filter runs, you can more or less sit and wait for the exact text you’re looking for to come through the filter, and change it. You just have to test for the exact text sent through the double-underscore __() translate function which comes into the callback function as $untranslated_text. In the code above I’m looking for what’s coming through in wp-signup.php on line 224 (at the time of my writing).

Conceivably (although unlikely) this exact text could show up on another page, so, I’ve checked for both the page and whether or not WordPress is even running in multisite to begin with.

This is just running as a theme function, but you could use this in a plugin too. You just need to be able to be able to add a function to the filter and it should work fine.

I hope someone out there finds this useful. It’s a bit annoying that there isn’t a more straightforward way of accomplishing this, but I guess this can do for now.

5 thoughts on “Customizing Text on WordPress’s wp-signup.php Page

    • Yep. Actually, posting this helped me to see a few things I forgot to style in the theme… 9_9

      I’m now seeing I should do some styling on the comments as well.

  1. Thank you, this was exactly what I was looking for.

    There’s a ” missing in the code though. Right after: “theme_text_domain&quot

    • Whoops, thanks for pointing that out! Looks like the quote got swapped out with the HTML Entity for the quote at some point…

Comments are closed.