Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/extras.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/extras.php	(revision 3271)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/extras.php	(working copy)
@@ -96,7 +96,7 @@
  * @return string
  */
 function wporg_filter_archive_excerpt( $excerpt ) {
-	if ( ! is_single() && ! wporg_is_handbook() ) {
+	if ( ! is_single() && ! get_query_var( 'is_handbook' ) ) {
 
 		$post_id = get_the_ID();
 		$type    = get_post_type_object( get_post_type( $post_id ) )->labels->singular_name;
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/handbooks.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/handbooks.php	(revision 3271)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/handbooks.php	(working copy)
@@ -34,6 +34,10 @@
 	 * @access public
 	 */
 	public static function do_init() {
+		add_filter( 'query_vars',  array( __CLASS__, 'add_query_vars' ) );
+
+		add_action( 'pre_get_posts',  array( __CLASS__, 'pre_get_posts' ), 9 );
+
 		add_action( 'after_switch_theme', array( __CLASS__, 'add_roles' ) );
 
 		add_filter( 'user_has_cap', array( __CLASS__, 'adjust_handbook_editor_caps' ), 11 );
@@ -54,6 +58,39 @@
 	}
 
 	/**
+	 * Add public query vars for handbooks.
+	 *
+	 * @param array   $public_query_vars The array of whitelisted query variables.
+	 * @return array Array with public query vars.
+	 */
+	public static function add_query_vars( $public_query_vars ) {
+		$public_query_vars['is_handbook'] = false;
+		$public_query_vars['current_handbook'] = false;
+		$public_query_vars['current_handbook_home_url'] = false;
+		$public_query_vars['current_handbook_name'] = '';
+		return $public_query_vars;
+	}
+
+	/**
+	 * Add handbook query vars to the current query.
+	 *
+	 * @param \WP_Query $query
+	 */
+	public static function pre_get_posts( $query ) {
+		$is_handbook = function_exists( 'wporg_is_handbook' ) ? wporg_is_handbook() : false;
+		$query->set( 'is_handbook', $is_handbook );
+
+		$current_handbook = function_exists( 'wporg_get_current_handbook' ) ? wporg_get_current_handbook() : false;
+		$query->set( 'current_handbook', $current_handbook );
+
+		$current_handbook_home_url = function_exists( 'wporg_get_current_handbook_home_url' ) ? wporg_get_current_handbook_home_url() : false;
+		$query->set( 'current_handbook_home_url', $current_handbook_home_url );
+
+		$current_handbook_name = function_exists( 'wporg_get_current_handbook_name' ) ? wporg_get_current_handbook_name() : '';
+		$query->set( 'current_handbook_name', $current_handbook_name );
+	}
+
+	/**
 	 * If a syntax highlighted code block exceeds a given number of lines, wrap the
 	 * markup with other markup to trigger the code expansion/collapse JS handling
 	 * already implemented for the code reference.
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/redirects.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/redirects.php	(revision 3271)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/redirects.php	(working copy)
@@ -32,7 +32,7 @@
 	 * Redirects a search query with only one result directly to that result.
 	 */
 	public static function redirect_single_search_match() {
-		if ( is_search() && ! wporg_is_handbook() && 1 == $GLOBALS['wp_query']->found_posts ) {
+		if ( is_search() && ! get_query_var( 'is_handbook' ) && 1 == $GLOBALS['wp_query']->found_posts ) {
 			wp_redirect( get_permalink( get_post() ) );
 			exit();
 		}
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php	(revision 3271)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php	(working copy)
@@ -43,7 +43,7 @@
 
 		// Separates searches for handbook pages from non-handbook pages depending on
 		// whether the search was performed within context of a handbook page or not.
-		if ( wporg_is_handbook() ) {
+		if ( get_query_var( 'is_handbook' ) ) {
 			// Search only in current handbook post type.
 			// Just to make sure. post type should already be set.
 			$query->set( 'post_type', wporg_get_current_handbook() );
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php	(revision 3271)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content.php	(working copy)
@@ -62,7 +62,7 @@
 	 */
 	public static function scripts_and_styles() {
 		if ( is_singular() ) {
-			if ( '0' != get_comments_number() || \DevHub\post_type_has_source_code() || wporg_is_handbook_post_type() ) {
+			if ( '0' != get_comments_number() || \DevHub\post_type_has_source_code() || get_query_var( 'is_handbook' ) ) {
 				wp_enqueue_script( 'wporg-developer-function-reference', get_template_directory_uri() . '/js/function-reference.js', array( 'jquery', 'syntaxhighlighter-core', 'syntaxhighlighter-brush-php' ), '20150319', true );
 				wp_enqueue_style( 'syntaxhighlighter-core' );
 				wp_enqueue_style( 'syntaxhighlighter-theme-default' );
Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php
===================================================================
--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php	(revision 3271)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php	(working copy)
@@ -34,8 +34,9 @@
 <?php } ?>
 
 	<?php
-		$is_handbook = wporg_is_handbook();
-		$search_url  = $is_handbook ? wporg_get_current_handbook_home_url() : home_url( '/' );
+		$is_handbook = get_query_var( 'is_handbook' );
+		$search_url  = get_query_var( 'current_handbook_home_url' );
+		$search_url  = $search_url ? $search_url : home_url( '/' );
 		$form_class  = $is_handbook ? ' searchform-handbook' : '';
 	?>
 
