PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | jetpack_vendor/automattic/jetpack-connection/src/class-urls.php +24 -0 13.5.2 → 16.3 View file →
@@ -188,5 +188,29 @@
188 188 */
189 189 public static function main_network_site_url() {
190 190 return self::get_protocol_normalized_url( 'main_network_site_url', network_site_url() );
191 191 }
192 +
193 + /**
194 + * Maybe add the origin_site_id query parameter to a URL.
195 + *
196 + * The parameter is only added for users who are members of the current blog.
197 + *
198 + * @since 7.1.0
199 + *
200 + * @param string $url The URL to add the query param to.
201 + * @return string The URL with the origin_site_id query parameter maybe added.
202 + */
203 + public static function maybe_add_origin_site_id( $url ) {
204 + $site_id = Manager::get_site_id();
205 + if ( is_wp_error( $site_id ) ) {
206 + return $url;
207 + }
208 +
209 + // Add query param to URL only for users who can access wp-admin.
210 + if ( ! is_user_member_of_blog() ) {
211 + return $url;
212 + }
213 +
214 + return add_query_arg( 'origin_site_id', $site_id, $url );
215 + }
192 216 }