0

I need to change the following default text on the WordPress multisite signup page (wp-signup.php):

"There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!"

...since this WordPress install will be limiting the number of sites a user can create.

Is it possible to override the content of this page without hacking the wp-signup.php file or dealing with .htaccess?

This WordPress install is being hosted by a third party service and it would be best if I could avoid dealing with modifying these files.

4

2 回答 2

1

我设法找到了另一个解决方案。事实证明,由于 wp-signup.php 页面上的文本是通过 __() 运行的,因此您可以使用“ gettext ”过滤器来更改它,如下所示:

/**
 * 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' ) {

    switch ( $untranslated_text ) {
            case '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&#8217;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. Remember to write responsibly or some junk! Ciao!', 'theme_text_domain' );
            break;
        }
    }

    return $translated_text;
}
add_filter( 'gettext', 'themename_wp_signup_text', 20, 3 );

...这只是一个主题,但你也可以在插件中做到这一点。

所以文本在技术上是可过滤的,但我会说这是一个巨大的黑客攻击,但它会做,并且不应该产生任何后果,直到 WordPress 核心中的特定文本发生变化......

于 2013-08-29T19:12:28.137 回答
0

正如 Dave Kiss 在上面的评论中所说,此字符串不可过滤,因此您无法过滤文本。该字符串也没有标记,因此您不能使用翻译文件。

我建议您打开 WordPress Trac 票证,请求标记文本或使其可过滤。

你可以在这里开一张新票:http: //core.trac.wordpress.org/

于 2013-08-27T17:20:28.233 回答