Skip to content

Commit d672f98

Browse files
committed
RestrictedFunctionsSniff: Change default message of switch_to_blog() to VIP Go context
1 parent 8383d16 commit d672f98

File tree

3 files changed

+1
-5
lines changed

3 files changed

+1
-5
lines changed

WordPress-VIP-Go/ruleset-test.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,6 @@
336336
196 => [
337337
'Stylesheets should be registered/enqueued via `wp_enqueue_style`. This can improve the site\'s performance due to styles concatenation.',
338338
],
339-
269 => [
340-
'Switch to blog may not work as expected since it only changes the database context for the blog and does not load the plugins or theme of that site. This means that filters or hooks that the blog you are switching to uses will not run.',
341-
],
342339
],
343340
];
344341

WordPress-VIP-Go/ruleset.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@
246246
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.switch_to_blog_switch_to_blog">
247247
<type>warning</type>
248248
<severity>3</severity>
249-
<message>Switch to blog may not work as expected since it only changes the database context for the blog and does not load the plugins or theme of that site. This means that filters or hooks that the blog you are switching to uses will not run.</message>
250249
</rule>
251250
<rule ref="WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn">
252251
<severity>3</severity>

WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function getGroups() {
9898
// @link https://docs.wpvip.com/technical-references/code-review/vip-notices/#h-switch_to_blog
9999
'switch_to_blog' => [
100100
'type' => 'error',
101-
'message' => '%s() is not something you should ever need to do in a VIP theme context. Instead use an API (XML-RPC, REST) to interact with other sites if needed.',
101+
'message' => '%s() may not work as expected since it only changes the database context for the blog and does not load the plugins or theme of that site. Filters or hooks on the blog you are switching to will not run.',
102102
'functions' => [
103103
'switch_to_blog',
104104
],

0 commit comments

Comments
 (0)