Index: src/wp-includes/rewrite.php
===================================================================
--- src/wp-includes/rewrite.php	(revision 28748)
+++ src/wp-includes/rewrite.php	(working copy)
@@ -2041,9 +2041,10 @@
 	 * @since 2.0.1
 	 * @access public
 	 * @param bool $hard Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard).
+     * @return string Returns either 'soft' or 'hard' based on the type of flush attempted.
 	 */
 	public function flush_rules($hard = true) {
-		delete_option('rewrite_rules');
+		delete_option( 'rewrite_rules' );
 		$this->wp_rewrite_rules();
 		/**
 		 * Filter whether a "hard" rewrite rule flush should be performed when requested.
@@ -2054,13 +2055,16 @@
 		 *
 		 * @param bool $hard Whether to flush rewrite rules "hard". Default true.
 		 */
-		if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) ) {
-			return;
+		if ( ! $hard && ! apply_filters( 'flush_rewrite_rules_hard', false ) ) {
+			return 'soft';
 		}
-		if ( function_exists( 'save_mod_rewrite_rules' ) )
+		if ( function_exists( 'save_mod_rewrite_rules' ) ) {
 			save_mod_rewrite_rules();
-		if ( function_exists( 'iis7_save_url_rewrite_rules' ) )
+		}
+		if ( function_exists( 'iis7_save_url_rewrite_rules' ) ) {
 			iis7_save_url_rewrite_rules();
+		}
+		return 'hard';
 	}
 
 	/**
Index: tests/phpunit/tests/rewrite.php
===================================================================
--- tests/phpunit/tests/rewrite.php	(revision 28748)
+++ tests/phpunit/tests/rewrite.php	(working copy)
@@ -117,4 +117,70 @@
 
 		restore_current_blog();
 	}
+
+    /**
+     * @ticket 28517
+     */
+    function test_flush_rules_hard_true_no_filters() {
+        // hard true - filter false
+        $actual = $GLOBALS['wp_rewrite']->flush_rules( true );
+        $this->assertEquals( $actual, 'hard' );
+    }
+
+    /**
+     * @ticket 28517
+     */
+    function test_flush_rules_hard_false_no_filters() {
+        // hard false - filter false
+        $actual = $GLOBALS['wp_rewrite']->flush_rules( false );
+        $this->assertEquals( $actual, 'soft' );
+    }
+
+    /**
+     * @ticket 28517
+     */
+    function test_flush_rules_hard_true_with_filters_true() {
+        // adding a filter that returns true
+        add_filter( 'flush_rewrite_rules_hard', function() { return true; } );
+
+        // hard true - filter true
+        $actual = $GLOBALS['wp_rewrite']->flush_rules( true );
+        $this->assertEquals( $actual, 'hard' );
+    }
+
+    /**
+     * @ticket 28517
+     */
+    function test_flush_rules_hard_true_with_filters_false() {
+        // adding a filter that returns true
+        add_filter( 'flush_rewrite_rules_hard', function() { return false; } );
+
+        // hard true - filter true
+        $actual = $GLOBALS['wp_rewrite']->flush_rules( true );
+        $this->assertEquals( $actual, 'hard' );
+    }
+
+    /**
+     * @ticket 28517
+     */
+    function test_flush_rules_hard_false_with_filters_true() {
+        // adding a filter that returns true
+        add_filter( 'flush_rewrite_rules_hard', function() { return true; } );
+
+        // hard false - filter true
+        $actual = $GLOBALS['wp_rewrite']->flush_rules( false );
+        $this->assertEquals( $actual, 'hard' );
+    }
+
+    /**
+     * @ticket 28517
+     */
+    function test_flush_rules_hard_false_with_filters_false() {
+        // adding a filter that returns true
+        add_filter( 'flush_rewrite_rules_hard', function() { return false; } );
+
+        // hard false - filter false
+        $actual = $GLOBALS['wp_rewrite']->flush_rules( false );
+        $this->assertEquals( $actual, 'soft' );
+    }
 }
\ No newline at end of file
