diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 33fcfbb..12e07f7 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -1723,10 +1723,8 @@ function wp_get_archives( $args = '' ) {
 		$r['type'] = 'monthly';
 	}
 
-	if ( ! empty( $r['limit'] ) ) {
-		$r['limit'] = absint( $r['limit'] );
-		$r['limit'] = ' LIMIT ' . $r['limit'];
-	}
+	$r['limit'] = is_numeric( $r['limit'] ) ? absint( $r['limit'] ) : 0;
+	$r['limit'] = $r['limit'] ? ' LIMIT ' . $r['limit'] : '';
 
 	$order = strtoupper( $r['order'] );
 	if ( $order !== 'ASC' ) {
