diff --git src/wp-includes/plugin.php src/wp-includes/plugin.php
index 27a65ee..06d727f 100644
--- src/wp-includes/plugin.php
+++ src/wp-includes/plugin.php
@@ -325,10 +325,10 @@ function remove_all_filters( $tag, $priority = false ) {
 	global $wp_filter, $merged_filters;
 
 	if ( isset( $wp_filter[ $tag ]) ) {
-		if ( false !== $priority && isset( $wp_filter[ $tag ][ $priority ] ) ) {
-			$wp_filter[ $tag ][ $priority ] = array();
-		} else {
+		if ( false === $priority ) {
 			$wp_filter[ $tag ] = array();
+		} else if ( isset( $wp_filter[ $tag ][ $priority ] ) ) {
+			$wp_filter[ $tag ][ $priority ] = array();
 		}
 	}
 
diff --git tests/phpunit/tests/filters.php tests/phpunit/tests/filters.php
index c0eb125..d9eda55 100644
--- tests/phpunit/tests/filters.php
+++ tests/phpunit/tests/filters.php
@@ -197,6 +197,25 @@ class Tests_Filters extends WP_UnitTestCase {
 	}
 
 	/**
+	 * @ticket 20920
+	 */
+	function test_remove_all_filters_should_respect_the_priority_argument() {
+		$a = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+
+		add_filter( $tag, array( $a, 'filter' ), 12 );
+		$this->assertTrue( has_filter( $tag ) );
+
+		// Should not be removed.
+		remove_all_filters( $tag, 11 );
+		$this->assertTrue( has_filter( $tag ) );
+
+		remove_all_filters( $tag, 12 );
+		$this->assertFalse( has_filter( $tag ) );
+	}
+
+	/**
 	 * @ticket 9886
 	 */
 	function test_filter_ref_array() {
