Index: wp-admin/js/editor.js
===================================================================
--- wp-admin/js/editor.js	(revision 26051)
+++ wp-admin/js/editor.js	(working copy)
@@ -1,23 +1,25 @@
-
 var switchEditors = {
 
-	switchto: function(el) {
-		var aid = el.id, l = aid.length, id = aid.substr(0, l - 5), mode = aid.substr(l - 4);
+	switchto: function( el ) {
+		var aid = el.id,
+			l = aid.length,
+			id = aid.substr( 0, l - 5 ),
+			mode = aid.substr( l - 4 );
 
 		this.go(id, mode);
 	},
 
-	go: function(id, mode) { // mode can be 'html', 'tmce', or 'toggle'; 'html' is used for the "Text" editor tab.
+	go: function( id, mode ) { // mode can be 'html', 'tmce', or 'toggle'; 'html' is used for the "Text" editor tab.
 		id = id || 'content';
 		mode = mode || 'toggle';
 
-		var t = this, ed = tinyMCE.get(id), wrap_id, txtarea_el, dom = tinymce.DOM;
+		var t = this, ed = tinyMCE.get( id ), wrap_id, txtarea_el, dom = tinymce.DOM;
 
-		wrap_id = 'wp-'+id+'-wrap';
-		txtarea_el = dom.get(id);
+		wrap_id = 'wp-' + id + '-wrap';
+		txtarea_el = dom.get( id );
 
 		if ( 'toggle' == mode ) {
-			if ( ed && !ed.isHidden() )
+			if ( ed && ! ed.isHidden() )
 				mode = 'html';
 			else
 				mode = 'tmce';
@@ -27,22 +29,22 @@
 			if ( ed && ! ed.isHidden() )
 				return false;
 
-			if ( typeof(QTags) != 'undefined' )
-				QTags.closeAllTags(id);
+			if ( typeof( QTags ) != 'undefined' )
+				QTags.closeAllTags( id );
 
-			if ( tinyMCEPreInit.mceInit[id] && tinyMCEPreInit.mceInit[id].wpautop )
+			if ( tinyMCEPreInit.mceInit[ id ] && tinyMCEPreInit.mceInit[ id ].wpautop )
 				txtarea_el.value = t.wpautop( txtarea_el.value );
 
 			if ( ed ) {
 				ed.show();
 			} else {
-				ed = new tinymce.Editor(id, tinyMCEPreInit.mceInit[id]);
+				ed = new tinymce.Editor( id, tinyMCEPreInit.mceInit[ id ] );
 				ed.render();
 			}
 
-			dom.removeClass(wrap_id, 'html-active');
-			dom.addClass(wrap_id, 'tmce-active');
-			setUserSetting('editor', 'tinymce');
+			dom.removeClass( wrap_id, 'html-active' );
+			dom.addClass( wrap_id, 'tmce-active' );
+			setUserSetting( 'editor', 'tinymce' );
 
 		} else if ( 'html' == mode ) {
 
@@ -53,155 +55,158 @@
 				ed.hide();
 			} else {
 				// The TinyMCE instance doesn't exist, run the content through "pre_wpautop()" and show the textarea
-				if ( tinyMCEPreInit.mceInit[id] && tinyMCEPreInit.mceInit[id].wpautop )
+				if ( tinyMCEPreInit.mceInit[ id ] && tinyMCEPreInit.mceInit[ id ].wpautop )
 					txtarea_el.value = t.pre_wpautop( txtarea_el.value );
 
-				dom.setStyles(txtarea_el, {'display': '', 'visibility': ''});
+				dom.setStyles( txtarea_el, {'display': '', 'visibility': ''} );
 			}
 
-			dom.removeClass(wrap_id, 'tmce-active');
-			dom.addClass(wrap_id, 'html-active');
-			setUserSetting('editor', 'html');
+			dom.removeClass( wrap_id, 'tmce-active' );
+			dom.addClass( wrap_id, 'html-active' );
+			setUserSetting( 'editor', 'html' );
 		}
 		return false;
 	},
 
-	_wp_Nop : function(content) {
-		var blocklist1, blocklist2, preserve_linebreaks = false, preserve_br = false;
+	_wp_Nop: function( content ) {
+		var blocklist1,
+			blocklist2,
+			preserve_linebreaks = false,
+			preserve_br = false;
 
 		// Protect pre|script tags
-		if ( content.indexOf('<pre') != -1 || content.indexOf('<script') != -1 ) {
+		if ( content.indexOf( '<pre' ) != -1 || content.indexOf( '<script' ) != -1 ) {
 			preserve_linebreaks = true;
-			content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
-				a = a.replace(/<br ?\/?>(\r\n|\n)?/g, '<wp-temp-lb>');
-				return a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-temp-lb>');
+			content = content.replace( /<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function( a ) {
+				a = a.replace( /<br ?\/?>(\r\n|\n)?/g, '<wp-temp-lb>' );
+				return a.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-temp-lb>' );
 			});
 		}
 
 		// keep <br> tags inside captions and remove line breaks
-		if ( content.indexOf('[caption') != -1 ) {
+		if ( content.indexOf( '[caption' ) != -1 ) {
 			preserve_br = true;
-			content = content.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(a) {
-				return a.replace(/<br([^>]*)>/g, '<wp-temp-br$1>').replace(/[\r\n\t]+/, '');
+			content = content.replace( /\[caption[\s\S]+?\[\/caption\]/g, function( a ) {
+				return a.replace( /<br([^>]*)>/g, '<wp-temp-br$1>' ).replace( /[\r\n\t]+/, '' );
 			});
 		}
 
 		// Pretty it up for the source editor
 		blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset';
-		content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'g'), '</$1>\n');
-		content = content.replace(new RegExp('\\s*<((?:'+blocklist1+')(?: [^>]*)?)>', 'g'), '\n<$1>');
+		content = content.replace( new RegExp( '\\s*</(' + blocklist1 + ')>\\s*', 'g' ), '</$1>\n' );
+		content = content.replace( new RegExp( '\\s*<((?:' + blocklist1 + ')(?: [^>]*)?)>', 'g' ), '\n<$1>' );
 
 		// Mark </p> if it has any attributes.
-		content = content.replace(/(<p [^>]+>.*?)<\/p>/g, '$1</p#>');
+		content = content.replace( /(<p [^>]+>.*?)<\/p>/g, '$1</p#>' );
 
 		// Separate <div> containing <p>
-		content = content.replace(/<div( [^>]*)?>\s*<p>/gi, '<div$1>\n\n');
+		content = content.replace( /<div( [^>]*)?>\s*<p>/gi, '<div$1>\n\n' );
 
 		// Remove <p> and <br />
-		content = content.replace(/\s*<p>/gi, '');
-		content = content.replace(/\s*<\/p>\s*/gi, '\n\n');
-		content = content.replace(/\n[\s\u00a0]+\n/g, '\n\n');
-		content = content.replace(/\s*<br ?\/?>\s*/gi, '\n');
+		content = content.replace( /\s*<p>/gi, '' );
+		content = content.replace( /\s*<\/p>\s*/gi, '\n\n' );
+		content = content.replace( /\n[\s\u00a0]+\n/g, '\n\n' );
+		content = content.replace( /\s*<br ?\/?>\s*/gi, '\n' );
 
 		// Fix some block element newline issues
-		content = content.replace(/\s*<div/g, '\n<div');
-		content = content.replace(/<\/div>\s*/g, '</div>\n');
-		content = content.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi, '\n\n[caption$1[/caption]\n\n');
-		content = content.replace(/caption\]\n\n+\[caption/g, 'caption]\n\n[caption');
+		content = content.replace( /\s*<div/g, '\n<div' );
+		content = content.replace( /<\/div>\s*/g, '</div>\n' );
+		content = content.replace( /\s*\[caption([^\[]+)\[\/caption\]\s*/gi, '\n\n[caption$1[/caption]\n\n' );
+		content = content.replace( /caption\]\n\n+\[caption/g, 'caption]\n\n[caption' );
 
 		blocklist2 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset';
-		content = content.replace(new RegExp('\\s*<((?:'+blocklist2+')(?: [^>]*)?)\\s*>', 'g'), '\n<$1>');
-		content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'g'), '</$1>\n');
-		content = content.replace(/<li([^>]*)>/g, '\t<li$1>');
+		content = content.replace( new RegExp('\\s*<((?:' + blocklist2 + ')(?: [^>]*)?)\\s*>', 'g' ), '\n<$1>' );
+		content = content.replace( new RegExp('\\s*</(' + blocklist2 + ')>\\s*', 'g' ), '</$1>\n' );
+		content = content.replace( /<li([^>]*)>/g, '\t<li$1>' );
 
-		if ( content.indexOf('<hr') != -1 ) {
-			content = content.replace(/\s*<hr( [^>]*)?>\s*/g, '\n\n<hr$1>\n\n');
+		if ( content.indexOf( '<hr' ) != -1 ) {
+			content = content.replace( /\s*<hr( [^>]*)?>\s*/g, '\n\n<hr$1>\n\n' );
 		}
 
-		if ( content.indexOf('<object') != -1 ) {
-			content = content.replace(/<object[\s\S]+?<\/object>/g, function(a){
-				return a.replace(/[\r\n]+/g, '');
+		if ( content.indexOf( '<object' ) != -1 ) {
+			content = content.replace( /<object[\s\S]+?<\/object>/g, function( a ) {
+				return a.replace( /[\r\n]+/g, '' );
 			});
 		}
 
 		// Unmark special paragraph closing tags
-		content = content.replace(/<\/p#>/g, '</p>\n');
-		content = content.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, '\n$1');
+		content = content.replace( /<\/p#>/g, '</p>\n' );
+		content = content.replace( /\s*(<p [^>]+>[\s\S]*?<\/p>)/g, '\n$1' );
 
 		// Trim whitespace
-		content = content.replace(/^\s+/, '');
-		content = content.replace(/[\s\u00a0]+$/, '');
+		content = content.replace( /^\s+/, '' );
+		content = content.replace( /[\s\u00a0]+$/, '' );
 
 		// put back the line breaks in pre|script
 		if ( preserve_linebreaks )
-			content = content.replace(/<wp-temp-lb>/g, '\n');
+			content = content.replace( /<wp-temp-lb>/g, '\n' );
 
 		// and the <br> tags in captions
 		if ( preserve_br )
-			content = content.replace(/<wp-temp-br([^>]*)>/g, '<br$1>');
+			content = content.replace( /<wp-temp-br([^>]*)>/g, '<br$1>' );
 
 		return content;
 	},
 
-	_wp_Autop : function(pee) {
+	_wp_Autop: function(pee) {
 		var preserve_linebreaks = false, preserve_br = false,
 			blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|noscript|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary';
 
-		if ( pee.indexOf('<object') != -1 ) {
-			pee = pee.replace(/<object[\s\S]+?<\/object>/g, function(a){
-				return a.replace(/[\r\n]+/g, '');
+		if ( pee.indexOf( '<object' ) != -1 ) {
+			pee = pee.replace( /<object[\s\S]+?<\/object>/g, function( a ) {
+				return a.replace( /[\r\n]+/g, '' );
 			});
 		}
 
-		pee = pee.replace(/<[^<>]+>/g, function(a){
-			return a.replace(/[\r\n]+/g, ' ');
+		pee = pee.replace( /<[^<>]+>/g, function( a ){
+			return a.replace( /[\r\n]+/g, ' ' );
 		});
 
 		// Protect pre|script tags
-		if ( pee.indexOf('<pre') != -1 || pee.indexOf('<script') != -1 ) {
+		if ( pee.indexOf( '<pre' ) != -1 || pee.indexOf( '<script' ) != -1 ) {
 			preserve_linebreaks = true;
-			pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
-				return a.replace(/(\r\n|\n)/g, '<wp-temp-lb>');
+			pee = pee.replace( /<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function( a ) {
+				return a.replace( /(\r\n|\n)/g, '<wp-temp-lb>' );
 			});
 		}
 
 		// keep <br> tags inside captions and convert line breaks
-		if ( pee.indexOf('[caption') != -1 ) {
+		if ( pee.indexOf( '[caption' ) != -1 ) {
 			preserve_br = true;
-			pee = pee.replace(/\[caption[\s\S]+?\[\/caption\]/g, function(a) {
+			pee = pee.replace( /\[caption[\s\S]+?\[\/caption\]/g, function( a ) {
 				// keep existing <br>
-				a = a.replace(/<br([^>]*)>/g, '<wp-temp-br$1>');
+				a = a.replace( /<br([^>]*)>/g, '<wp-temp-br$1>' );
 				// no line breaks inside HTML tags
-				a = a.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(b){
-					return b.replace(/[\r\n\t]+/, ' ');
+				a = a.replace( /<[a-zA-Z0-9]+( [^<>]+)?>/g, function( b ){
+					return b.replace( /[\r\n\t]+/, ' ' );
 				});
 				// convert remaining line breaks to <br>
-				return a.replace(/\s*\n\s*/g, '<wp-temp-br />');
+				return a.replace( /\s*\n\s*/g, '<wp-temp-br />' );
 			});
 		}
 
 		pee = pee + '\n\n';
-		pee = pee.replace(/<br \/>\s*<br \/>/gi, '\n\n');
-		pee = pee.replace(new RegExp('(<(?:'+blocklist+')(?: [^>]*)?>)', 'gi'), '\n$1');
-		pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), '$1\n\n');
-		pee = pee.replace(/<hr( [^>]*)?>/gi, '<hr$1>\n\n'); // hr is self closing block element
-		pee = pee.replace(/\r\n|\r/g, '\n');
-		pee = pee.replace(/\n\s*\n+/g, '\n\n');
-		pee = pee.replace(/([\s\S]+?)\n\n/g, '<p>$1</p>\n');
-		pee = pee.replace(/<p>\s*?<\/p>/gi, '');
-		pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')(?: [^>]*)?>)\\s*</p>', 'gi'), "$1");
-		pee = pee.replace(/<p>(<li.+?)<\/p>/gi, '$1');
-		pee = pee.replace(/<p>\s*<blockquote([^>]*)>/gi, '<blockquote$1><p>');
-		pee = pee.replace(/<\/blockquote>\s*<\/p>/gi, '</p></blockquote>');
-		pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')(?: [^>]*)?>)', 'gi'), "$1");
-		pee = pee.replace(new RegExp('(</?(?:'+blocklist+')(?: [^>]*)?>)\\s*</p>', 'gi'), "$1");
-		pee = pee.replace(/\s*\n/gi, '<br />\n');
-		pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
-		pee = pee.replace(/<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi, '$1');
-		pee = pee.replace(/(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi, '[caption$1[/caption]');
+		pee = pee.replace( /<br \/>\s*<br \/>/gi, '\n\n' );
+		pee = pee.replace( new RegExp( '(<(?:' + blocklist + ')(?: [^>]*)?>)', 'gi' ), '\n$1' );
+		pee = pee.replace( new RegExp( '(</(?:' + blocklist + ')>)', 'gi' ), '$1\n\n' );
+		pee = pee.replace( /<hr( [^>]*)?>/gi, '<hr$1>\n\n' ); // hr is self closing block element
+		pee = pee.replace( /\r\n|\r/g, '\n' );
+		pee = pee.replace( /\n\s*\n+/g, '\n\n' );
+		pee = pee.replace( /([\s\S]+?)\n\n/g, '<p>$1</p>\n' );
+		pee = pee.replace( /<p>\s*?<\/p>/gi, '');
+		pee = pee.replace( new RegExp( '<p>\\s*(</?(?:' + blocklist + ')(?: [^>]*)?>)\\s*</p>', 'gi' ), "$1" );
+		pee = pee.replace( /<p>(<li.+?)<\/p>/gi, '$1');
+		pee = pee.replace( /<p>\s*<blockquote([^>]*)>/gi, '<blockquote$1><p>');
+		pee = pee.replace( /<\/blockquote>\s*<\/p>/gi, '</p></blockquote>');
+		pee = pee.replace( new RegExp( '<p>\\s*(</?(?:' + blocklist + ')(?: [^>]*)?>)', 'gi' ), "$1" );
+		pee = pee.replace( new RegExp( '(</?(?:' + blocklist + ')(?: [^>]*)?>)\\s*</p>', 'gi' ), "$1" );
+		pee = pee.replace( /\s*\n/gi, '<br />\n');
+		pee = pee.replace( new RegExp( '(</?(?:' + blocklist + ')[^>]*>)\\s*<br />', 'gi' ), "$1" );
+		pee = pee.replace( /<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi, '$1' );
+		pee = pee.replace( /(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi, '[caption$1[/caption]' );
 
-		pee = pee.replace(/(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g, function(a, b, c) {
-			if ( c.match(/<p( [^>]*)?>/) )
+		pee = pee.replace( /(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g, function( a, b, c ) {
+			if ( c.match( /<p( [^>]*)?>/ ) )
 				return a;
 
 			return b + '<p>' + c + '</p>';
@@ -209,37 +214,37 @@
 
 		// put back the line breaks in pre|script
 		if ( preserve_linebreaks )
-			pee = pee.replace(/<wp-temp-lb>/g, '\n');
+			pee = pee.replace( /<wp-temp-lb>/g, '\n' );
 
 		if ( preserve_br )
-			pee = pee.replace(/<wp-temp-br([^>]*)>/g, '<br$1>');
+			pee = pee.replace( /<wp-temp-br([^>]*)>/g, '<br$1>' );
 
 		return pee;
 	},
 
-	pre_wpautop : function(content) {
+	pre_wpautop: function( content ) {
 		var t = this, o = { o: t, data: content, unfiltered: content },
-			q = typeof(jQuery) != 'undefined';
+			q = typeof( jQuery ) != 'undefined';
 
 		if ( q )
-			jQuery('body').trigger('beforePreWpautop', [o]);
-		o.data = t._wp_Nop(o.data);
+			jQuery( 'body' ).trigger( 'beforePreWpautop', [ o ] );
+		o.data = t._wp_Nop( o.data );
 		if ( q )
-			jQuery('body').trigger('afterPreWpautop', [o]);
+			jQuery('body').trigger('afterPreWpautop', [ o ] );
 
 		return o.data;
 	},
 
-	wpautop : function(pee) {
+	wpautop: function( pee ) {
 		var t = this, o = { o: t, data: pee, unfiltered: pee },
-			q = typeof(jQuery) != 'undefined';
+			q = typeof( jQuery ) != 'undefined';
 
 		if ( q )
-			jQuery('body').trigger('beforeWpautop', [o]);
-		o.data = t._wp_Autop(o.data);
+			jQuery( 'body' ).trigger('beforeWpautop', [ o ] );
+		o.data = t._wp_Autop( o.data );
 		if ( q )
-			jQuery('body').trigger('afterWpautop', [o]);
+			jQuery( 'body' ).trigger('afterWpautop', [ o ] );
 
 		return o.data;
 	}
-}
+};
\ No newline at end of file
Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 26051)
+++ wp-includes/query.php	(working copy)
@@ -1709,7 +1709,14 @@
 		$this->query_vars_hash = md5( serialize( $this->query_vars ) );
 		$this->query_vars_changed = false;
 
-		do_action_ref_array('parse_query', array(&$this));
+		/**
+		 * Fires after parse_query is complete.
+		 *
+		 * @since 1.5.2
+		 *
+		 * @param WP_Query &$this The WP_Query instance (passed by reference).
+		 */
+		do_action_ref_array( 'parse_query', array( &$this ) );
 	}
 
 	/**
@@ -1916,6 +1923,13 @@
 
 		$this->tax_query = new WP_Tax_Query( $tax_query );
 
+		/**
+		 * Fires after parse_tax_query is complete.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param WP_Query $this The WP_Query instance.
+		 */
 		do_action( 'parse_tax_query', $this );
 	}
 
@@ -2151,7 +2165,18 @@
 
 		$this->parse_query();
 
-		do_action_ref_array('pre_get_posts', array(&$this));
+		/**
+		 * Fires after the query variable object is created, but before the actual query is run.
+		 *
+		 * Note: keep in mind the context of any conditional tags you use. For example, to test
+		 * if THIS instance is the main query, use $this->is_main_query(). This is because the
+		 * global function versions, such as is_main_query(), are run on the global $wp_query instance.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param WP_Query &$this The WP_Query instance (passed by reference).
+		 */
+		do_action_ref_array( 'pre_get_posts', array( &$this ) );
 
 		// Shorthand.
 		$q = &$this->query_vars;
@@ -2791,8 +2816,25 @@
 		// Apply filters on where and join prior to paging so that any
 		// manipulations to them are reflected in the paging by day queries.
 		if ( !$q['suppress_filters'] ) {
-			$where = apply_filters_ref_array('posts_where', array( $where, &$this ) );
-			$join = apply_filters_ref_array('posts_join', array( $join, &$this ) );
+			/**
+			 * Filter the WHERE clause of the query.
+			 *
+			 * @since 1.5.2
+			 *
+			 * @param string   $where The WHERE clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$where = apply_filters_ref_array( 'posts_where', array( $where, &$this ) );
+
+			/**
+			 * Filter the JOIN clause of the query.
+			 *
+			 * @since 1.5.2
+			 *
+			 * @param string   $where The JOIN clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );
 		}
 
 		// Paging
@@ -2823,11 +2865,55 @@
 			}
 
 			if ( !$q['suppress_filters'] ) {
-				$cjoin = apply_filters_ref_array('comment_feed_join', array( $cjoin, &$this ) );
-				$cwhere = apply_filters_ref_array('comment_feed_where', array( $cwhere, &$this ) );
-				$cgroupby = apply_filters_ref_array('comment_feed_groupby', array( $cgroupby, &$this ) );
-				$corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
-				$climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
+				/**
+				 * Filter the JOIN clause of the comments feed query before sending.
+				 *
+				 * @since 1.5.2
+				 *
+				 * @param string   $cjoin The JOIN clause of the query.
+				 * @param WP_Query &$this The WP_Query instance (passed by reference).
+				 */
+				$cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) );
+
+				/**
+				 * Filter the WHERE clause of the comments feed query before sending.
+				 *
+				 * @since 1.5.2
+				 *
+				 * @param string   $cwhere The WHERE clause of the query.
+				 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+				 */
+				$cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) );
+
+				/**
+				 * Filter the GROUP BY clause of the comments feed query before sending.
+				 *
+				 * @since 1.5.2
+				 *
+				 * @param string   $cgroupby The GROUP BY clause of the query.
+				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
+				 */
+				$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) );
+
+				/**
+				 * Filter the ORDER BY clause of the comments feed query before sending.
+				 *
+				 * @since 1.5.2
+				 *
+				 * @param string   $corderby The ORDER BY clause of the query.
+				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
+				 */
+				$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
+
+				/**
+				 * Filter the LIMIT clause of the comments feed query before sending.
+				 *
+				 * @since 1.5.2
+				 *
+				 * @param string   $climits The JOIN clause of the query.
+				 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+				 */
+				$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
 			}
 			$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
 			$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
@@ -2850,38 +2936,212 @@
 
 		$pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
 
-		// Apply post-paging filters on where and join. Only plugins that
-		// manipulate paging queries should use these hooks.
 		if ( !$q['suppress_filters'] ) {
+			/**
+			 * Filter the WHERE clause of the query.
+			 *
+			 * Specifically for manipulating paging queries.
+			 *
+			 * @since 1.5.2
+			 *
+			 * @param string   $where The WHERE clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
 			$where		= apply_filters_ref_array( 'posts_where_paged',	array( $where, &$this ) );
+
+			/**
+			 * Filter the GROUP BY clause of the query.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param string   $groupby The GROUP BY clause of the query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
 			$groupby	= apply_filters_ref_array( 'posts_groupby',		array( $groupby, &$this ) );
+
+			/**
+			 * Filter the JOIN clause of the query.
+			 *
+			 * Specifically for manipulating paging queries.
+			 *
+			 * @since 1.5.2
+			 *
+			 * @param string   $join  The JOIN clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
 			$join		= apply_filters_ref_array( 'posts_join_paged',	array( $join, &$this ) );
+
+			/**
+			 * Filter the ORDER BY clause of the query.
+			 *
+			 * @since 1.5.2
+			 *
+			 * @param string   $orderby The ORDER BY clause of the query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
 			$orderby	= apply_filters_ref_array( 'posts_orderby',		array( $orderby, &$this ) );
+
+			/**
+			 * Filter the DISTINCT clause of the query.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string   $distinct The DISTINCT clause of the query.
+			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
+			 */
 			$distinct	= apply_filters_ref_array( 'posts_distinct',	array( $distinct, &$this ) );
+
+			/**
+			 * Filter the LIMIT clause of the query.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string   $limits The LIMIT clause of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
 			$limits		= apply_filters_ref_array( 'post_limits',		array( $limits, &$this ) );
+
+			/**
+			 * Filter the SELECT clause of the query.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string   $fields The SELECT clause of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
 			$fields		= apply_filters_ref_array( 'posts_fields',		array( $fields, &$this ) );
 
-			// Filter all clauses at once, for convenience
-			$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
+			$clauses = compact( $pieces );
+			/**
+			 * Filter all clauses at once, for convenience.
+			 *
+			 * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
+			 * fields (SELECT), and LIMITS clauses.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param array    $clauses The list of clauses for the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
+			$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( $clauses, &$this ) );
+
 			foreach ( $pieces as $piece )
 				$$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : '';
 		}
 
-		// Announce current selection parameters. For use by caching plugins.
-		do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
+		$selection = $where . $groupby . $orderby . $limits . $join;
+		/**
+		 * Fires to announce current selection parameters.
+		 *
+		 * For use by caching plugins.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param string $selection The assembled selection query.
+		 */
+		do_action( 'posts_selection', $selection );
 
 		// Filter again for the benefit of caching plugins. Regular plugins should use the hooks above.
 		if ( !$q['suppress_filters'] ) {
+			/**
+			 * Filter the WHERE clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $where The WHERE clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
 			$where		= apply_filters_ref_array( 'posts_where_request',		array( $where, &$this ) );
+
+			/**
+			 * Filter the GROUP BY clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $groupby The GROUP BY clause of the query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
 			$groupby	= apply_filters_ref_array( 'posts_groupby_request',		array( $groupby, &$this ) );
+
+			/**
+			 * Filter the JOIN clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $join  The JOIN clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
 			$join		= apply_filters_ref_array( 'posts_join_request',		array( $join, &$this ) );
+
+			/**
+			 * Filter the ORDER BY clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $orderby The ORDER BY clause of the query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
 			$orderby	= apply_filters_ref_array( 'posts_orderby_request',		array( $orderby, &$this ) );
+
+			/**
+			 * Filter the DISTINCT clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $distinct The DISTINCT clause of the query.
+			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
+			 */
 			$distinct	= apply_filters_ref_array( 'posts_distinct_request',	array( $distinct, &$this ) );
+
+			/**
+			 * Filter the SELECT clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $fields The SELECT clause of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
 			$fields		= apply_filters_ref_array( 'posts_fields_request',		array( $fields, &$this ) );
+
+			/**
+			 * Filter the LIMIT clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $limits The LIMIT clause of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
 			$limits		= apply_filters_ref_array( 'post_limits_request',		array( $limits, &$this ) );
 
-			// Filter all clauses at once, for convenience
-			$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
+			$clauses = compact( $pieces );
+			/**
+			 * Filter all clauses at once, for convenience.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
+			 * fields (SELECT), and LIMITS clauses.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param array    $pieces The pieces of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
+			$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( $clauses, &$this ) );
 			foreach ( $pieces as $piece )
 				$$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : '';
 		}
@@ -2898,7 +3158,16 @@
 		$this->request = $old_request = "SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
 
 		if ( !$q['suppress_filters'] ) {
-			$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );
+			$request = $this->request;
+			/**
+			 * Filter the completed SQL query before sending.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param array    $request The complete SQL query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
+			$this->request = apply_filters_ref_array( 'posts_request', array( $request, &$this ) );
 		}
 
 		if ( 'ids' == $q['fields'] ) {
@@ -2922,6 +3191,19 @@
 		}
 
 		$split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 );
+
+		/**
+		 * Filter the $split_the_query boolean.
+		 *
+		 * Splitting the query will cause it to fetch just the IDs of the found posts
+		 * (and then individually fetch each post by ID), rather than fetching every
+		 * complete row at once. One massive result vs. many small results.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param bool     $split_the_query Whether or not to split the query.
+		 * @param WP_Query $this            The WP_Query instance.
+		 */
 		$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this );
 
 		if ( $split_the_query ) {
@@ -2929,7 +3211,16 @@
 
 			$this->request = "SELECT $found_rows $distinct $wpdb->posts.ID FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
 
-			$this->request = apply_filters( 'posts_request_ids', $this->request, $this );
+			$request = $this->request;
+			/**
+			 * Filter the Post IDs SQL request before sending.
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param string   $request The post ID request.
+			 * @param WP_Query $this    The WP_Query instance.
+			 */
+			$this->request = apply_filters( 'posts_request_ids', $request, $this );
 
 			$ids = $wpdb->get_col( $this->request );
 
@@ -2949,18 +3240,37 @@
 		if ( $this->posts )
 			$this->posts = array_map( 'get_post', $this->posts );
 
-		// Raw results filter. Prior to status checks.
-		if ( !$q['suppress_filters'] )
-			$this->posts = apply_filters_ref_array('posts_results', array( $this->posts, &$this ) );
+		if ( !$q['suppress_filters'] ){
+			$posts = $this->posts;
+			/**
+			 * Filter the raw post results array, prior to status checks.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param array    $posts The post results array.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$this->posts = apply_filters_ref_array( 'posts_results', array( $posts, &$this ) );
+		}
 
 		if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
-			$cjoin = apply_filters_ref_array('comment_feed_join', array( '', &$this ) );
-			$cwhere = apply_filters_ref_array('comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
-			$cgroupby = apply_filters_ref_array('comment_feed_groupby', array( '', &$this ) );
+			// duplicate_hook
+			$cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
+
+			// duplicate_hook
+			$cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
+
+			// duplicate_hook
+			$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
 			$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
-			$corderby = apply_filters_ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
+
+			// duplicate_hook
+			$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
 			$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
-			$climits = apply_filters_ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
+
+			// duplicate_hook
+			$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
+
 			$comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits";
 			$this->comments = $wpdb->get_results($comments_request);
 			$this->comment_count = count($this->comments);
@@ -2994,8 +3304,18 @@
 				}
 			}
 
-			if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) )
-				$this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) );
+			if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ){
+				$post_preview = $this->posts[0];
+				/**
+				 * Filter the single post for preview mode.
+				 *
+				 * @since 2.7.0
+				 *
+				 * @param WP_Post  $post_preview  The Post object.
+				 * @param WP_Query &$this         The WP_Query instance (passed by reference).
+				 */
+				$this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $post_preview, &$this ) ) );
+			}
 		}
 
 		// Put sticky posts at the top of the posts array
@@ -3039,8 +3359,19 @@
 			}
 		}
 
-		if ( !$q['suppress_filters'] )
-			$this->posts = apply_filters_ref_array('the_posts', array( $this->posts, &$this ) );
+		if ( !$q['suppress_filters'] ){
+			$posts = $this->posts;
+			/**
+			 * Filter the array of retrieved posts after they've been fetched and
+			 * internally processed.
+			 *
+			 * @since 1.5.2
+			 *
+			 * @param array    $posts The array of retrieved posts.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$this->posts = apply_filters_ref_array( 'the_posts', array( $posts, &$this ) );
+		}
 
 		// Ensure that any posts added/modified via one of the filters above are
 		// of the type WP_Post and are filtered.
@@ -3076,12 +3407,32 @@
 		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
 			return;
 
-		if ( ! empty( $limits ) )
-			$this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
-		else
+		if ( ! empty( $limits ) ){
+			$found_posts = 'SELECT FOUND_ROWS()';
+			/**
+			 * Filter the query to run for retrieving the found posts.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string   $found_posts The query to run to find the found posts.
+			 * @param WP_Query &$this       The WP_Query instance (passed by reference).
+			 */
+			$this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( $found_posts, &$this ) ) );
+		}
+		else{
 			$this->found_posts = count( $this->posts );
+		}
 
-		$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
+		$found_posts = $this->found_posts;
+		/**
+		 * Filter the number of found posts.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param int      $found_posts The number of posts found.
+		 * @param WP_Query &$this       The WP_Query instance (passed by reference).
+		 */
+		$this->found_posts = apply_filters_ref_array( 'found_posts', array( $found_posts, &$this ) );
 
 		if ( ! empty( $limits ) )
 			$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
@@ -3119,7 +3470,14 @@
 		$this->in_the_loop = true;
 
 		if ( $this->current_post == -1 ) // loop has just started
-			do_action_ref_array('loop_start', array(&$this));
+			/**
+			 * Fires once the loop is started.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			do_action_ref_array( 'loop_start', array( &$this ) );
 
 		$post = $this->next_post();
 		setup_postdata($post);
@@ -3140,7 +3498,14 @@
 		if ( $this->current_post + 1 < $this->post_count ) {
 			return true;
 		} elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {
-			do_action_ref_array('loop_end', array(&$this));
+			/**
+			 * Fires once the loop has ended.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			do_action_ref_array( 'loop_end', array( &$this ) );
 			// Do some cleaning up after the loop
 			$this->rewind_posts();
 		}
@@ -3191,7 +3556,12 @@
 		$comment = $this->next_comment();
 
 		if ( $this->current_comment == 0 ) {
-			do_action('comment_loop_start');
+			/**
+			 * Fires once the comment loop is started.
+			 *
+			 * @since 2.2.0
+			 */
+			do_action( 'comment_loop_start' );
 		}
 	}
 
@@ -3957,7 +4327,14 @@
 		$pages = array( $post->post_content );
 	}
 
-	do_action_ref_array('the_post', array(&$post));
+	/**
+	 * Fires once the post data has been setup.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param WP_Post &$post The Post object (passed by reference).
+	 */
+	do_action_ref_array( 'the_post', array( &$post ) );
 
 	return true;
 }
