Index: src/bp-groups/bp-groups-template.php
===================================================================
--- src/bp-groups/bp-groups-template.php
+++ src/bp-groups/bp-groups-template.php
@@ -234,8 +234,25 @@
 
 		// Build pagination links
 		if ( (int) $this->total_group_count && (int) $this->pag_num ) {
+			$pag_args = array(
+				$page_arg => '%#%',
+				'num'     => $this->pag_num,
+				'sortby'  => $this->sort_by,
+				'order'   => $this->order,
+			);
+
+			if ( defined( 'DOING_AJAX' ) && true === (bool) DOING_AJAX ) {
+				$base = remove_query_arg( 's', wp_get_referer() );
+			} else {
+				$base = '';
+			}
+
+			if ( ! empty( $search_terms ) ) {
+				$pag_args['s'] = $search_terms;
+			}
+
 			$this->pag_links = paginate_links( array(
-				'base'      => add_query_arg( array( $page_arg => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
+				'base'      => add_query_arg( $pag_args, $base ),
 				'format'    => '',
 				'total'     => ceil( (int) $this->total_group_count / (int) $this->pag_num ),
 				'current'   => $this->pag_page,
Index: src/bp-members/bp-members-template.php
===================================================================
--- src/bp-members/bp-members-template.php
+++ src/bp-members/bp-members-template.php
@@ -264,8 +264,22 @@
 		}
 
 		if ( (int) $this->total_member_count && (int) $this->pag_num ) {
+			$pag_args = array(
+				$page_arg => '%#%',
+			);
+
+			if ( defined( 'DOING_AJAX' ) && true === (bool) DOING_AJAX ) {
+				$base = remove_query_arg( 's', wp_get_referer() );
+			} else {
+				$base = '';
+			}
+
+			if ( ! empty( $search_terms ) ) {
+				$pag_args['s'] = $search_terms;
+			}
+
 			$this->pag_links = paginate_links( array(
-				'base'      => add_query_arg( $page_arg, '%#%' ),
+				'base'      => add_query_arg( $pag_args, $base ),
 				'format'    => '',
 				'total'     => ceil( (int) $this->total_member_count / (int) $this->pag_num ),
 				'current'   => (int) $this->pag_page,
Index: src/bp-messages/bp-messages-template.php
===================================================================
--- src/bp-messages/bp-messages-template.php
+++ src/bp-messages/bp-messages-template.php
@@ -173,8 +173,22 @@
 		}
 
 		if ( (int) $this->total_thread_count && (int) $this->pag_num ) {
+			$pag_args = array(
+				$page_arg => '%#%',
+			);
+
+			if ( defined( 'DOING_AJAX' ) && true === (bool) DOING_AJAX ) {
+				$base = remove_query_arg( 's', wp_get_referer() );
+			} else {
+				$base = '';
+			}
+
+			if ( ! empty( $this->search_terms ) ) {
+				$pag_args['s'] = $this->search_terms;
+			}
+
 			$this->pag_links = paginate_links( array(
-				'base'      => add_query_arg( $page_arg, '%#%' ),
+				'base'      => add_query_arg( $pag_args, $base ),
 				'format'    => '',
 				'total'     => ceil( (int) $this->total_thread_count / (int) $this->pag_num ),
 				'current'   => $this->pag_page,
Index: src/bp-templates/bp-legacy/js/buddypress.js
===================================================================
--- src/bp-templates/bp-legacy/js/buddypress.js
+++ src/bp-templates/bp-legacy/js/buddypress.js
@@ -1689,10 +1689,6 @@
 		return false;
 	}
 
-	if ( bp_get_querystring('s') && !search_terms ) {
-		search_terms = bp_get_querystring('s');
-	}
-
 	if ( null === scope ) {
 		scope = 'all';
 	}
