[wp-trac] [WordPress Trac] #49263: Switching blog doesn't switch locale

WordPress Trac noreply at wordpress.org
Fri Jan 31 16:32:02 UTC 2020


#49263: Switching blog doesn't switch locale
-------------------------+------------------------------
 Reporter:  iandunn      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  I18N         |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  2nd-opinion  |     Focuses:  multisite
-------------------------+------------------------------

Comment (by iandunn):

 `switch_to_blog()`'s 2nd parameter has been deprecated since r21485, but
 I'm wondering if we could reuse it, instead of adding a new 3rd param?
 That would make the devex a bit smoother.

 Any thoughts?

 ----

 The old `$validate` param was a bool, so we could maintain back-compat by
 calling `_deprecated_argument()` if the value is anything other than an
 array. After calling it, the value could be overridden with `array()`, so
 that `$default_options` would be used, and the current behavior (not
 switching the locale) would be maintained).

 I scanned the directory for plugins that might be affected by that:

 `> ag "switch_to_blog\(\s?(.*)," --php ./plugins/ | tee scans/switch-to-
 blog.txt`

 Most are false-positives from plugins that include
 [https://github.com/Freemius/wordpress-sdk/blob/2443977/includes/class-
 freemius.php#L14792-L14803 a library that defines its own
 `switch_to_blog()` function], but that function doesn't ever call Core's
 `switch_to_blog()` with a 2nd argument.

 So so if we ignore those:

 `> cat scans/switch-to-blog.txt |grep -v "freemius" > scans/switch-to-
 blog-not-freemius.txt`

 ...then we get:

 {{{
 > ./summarize-scan.php scans/switch-to-blog-not-freemius.txt
 42 matching plugins
 Matches  Plugin                                     Active installs
 =======  ======                                     ===============
       1  ibexrentacar                                           10+
       1  radio-buttons-for-taxonomies                       10,000+
       1  wp-survey                                              10+
       2  linkedin-lite                                         300+
       1  static-html-output-plugin                          10,000+
       1  administrative-shortcodes                              70+
       2  threewp-broadcast                                   1,000+
       1  network-posts-extended                                600+
       1  blackbaud-sphere                                        0+
       1  redactor                                               10+
       1  wp-appkit                                           1,000+
       1  blogrollsync                                           10+
       1  export-readers                                          0+
       2  avatar-manager                                     10,000+
       1  multilingual-press                                    300+
       2  social-networks-auto-poster-facebook-twitter-g    100,000+
       1  pollme                                                 10+
       2  mu-widgets                                             10+
       1  rss-injection                                          10+
       1  wp-headfoot                                            40+
       3  lepress-20                                             10+
       1  wp-postdate                                            10+
       1  checkbox-for-taxonomies                               100+
       1  buddypress                                        200,000+
       1  wp-boilerplate                                         10+
       1  members-blog                                           10+
       1  quizme                                                 10+
       1  wp-submission                                          10+
       4  multisite-language-switcher                         7,000+
       3  woocommerce-billink                                   200+
       7  wp-optimize                                       900,000+
       1  jetpack                                         5,000,000+
       2  lcimedia-broadcast                                 REMOVED
       1  paymill                                               400+
       1  presstest                                          REMOVED
       2  broadcast-mu                                       REMOVED
       1  pressroom-by-newswire                                  60+
       1  single-posts-ext                                        0+
       1  slimjetpack                                         8,000+
       1  wp-contactme                                          100+
       1  blognetworking                                         10+
       1  blog-linkit                                            10+
 }}}

 `_deprecated_argument()` isn't currently being called for the 2nd param,
 so adding it would introduce new notices for those plugins. We could
 mitigate that by emailing them, and mentioning it in a dev-note on
 make/Core.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49263#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list