diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php
index 19f51a8..9785316 100644
--- a/src/wp-includes/admin-bar.php
+++ b/src/wp-includes/admin-bar.php
@@ -1130,7 +1130,7 @@ function is_admin_bar_showing() {
 	global $show_admin_bar, $pagenow;
 
 	// For all these types of requests, we never want an admin bar.
-	if ( defined( 'XMLRPC_REQUEST' ) || defined( 'DOING_AJAX' ) || defined( 'IFRAME_REQUEST' ) ) {
+	if ( wp_doing_xmlrpc() || defined( 'IFRAME_REQUEST' ) ) {
 		return false;
 	}
 
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index ec5a3d2..7e4b37a 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -2784,7 +2784,7 @@ function wp_die( $message = '', $title = '', $args = array() ) {
 		 * @param callable $function Callback function name.
 		 */
 		$function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
-	} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
+	} elseif ( wp_doing_xmlrpc() ) {
 		/**
 		 * Filters the callback for killing WordPress execution for XML-RPC requests.
 		 *
diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
index a29eed1..4ba8545 100644
--- a/src/wp-includes/load.php
+++ b/src/wp-includes/load.php
@@ -1155,6 +1155,24 @@ function wp_doing_cron() {
 }
 
 /**
+ * Determines whether the current request is a WordPress XML-RPC request.
+ *
+ * @since 5.0.0
+ *
+ * @return bool True if it's a WordPress XML-RPC request, false otherwise.
+ */
+function wp_doing_xmlrpc() {
+	/**
+	 * Filters whether the current request is a WordPress XML-RPC request.
+	 *
+	 * @since 5.0.0
+	 *
+	 * @param bool $wp_doing_cron Whether the current request is a WordPress XML-RPC request.
+	 */
+	return apply_filters( 'wp_doing_xmlrpc', defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST );
+}
+
+/**
  * Check whether variable is a WordPress Error.
  *
  * Returns true if $thing is an object of the WP_Error class.
diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
index 9a685b9..03302cc 100644
--- a/src/wp-includes/user.php
+++ b/src/wp-includes/user.php
@@ -2646,7 +2646,7 @@ function _wp_get_current_user() {
 		return $current_user;
 	}
 
-	if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
+	if ( wp_doing_xmlrpc() ) {
 		wp_set_current_user( 0 );
 		return $current_user;
 	}
