Title: [Plugin: AskApache Google 404] Breaks my theme
Last modified: August 19, 2016

---

# [Plugin: AskApache Google 404] Breaks my theme

 *  [GrampaB](https://wordpress.org/support/users/jgbennette/)
 * (@jgbennette)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/plugin-askapache-google-404-breaks-my-theme/)
 * This plugin breaks my theme and I’m not quite knowledgeable enough to figure 
   out why. I’ll keep working on it because I really like the added functionality
   for my visitors. But it’s a real pain right now.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [GrampaB](https://wordpress.org/support/users/jgbennette/)
 * (@jgbennette)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/plugin-askapache-google-404-breaks-my-theme/#post-1063191)
 * Oops – forgot to add a URL to the site. Powerstates.com. Try url [http://powerstates.com/test](http://powerstates.com/test)
   to see the AA Google 404 page.
 *  Thread Starter [GrampaB](https://wordpress.org/support/users/jgbennette/)
 * (@jgbennette)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/plugin-askapache-google-404-breaks-my-theme/#post-1063391)
 * The plugin inserts its code within my theme’s footer and I haven’t figured out
   why yet or how to fix it. The coding looks correct, but it doesn’t appear correct
   in a web browser. Still working at it – and posted a question at AskApache.
 *  [Doug Vanderweide](https://wordpress.org/support/users/dougvdotcom/)
 * (@dougvdotcom)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-askapache-google-404-breaks-my-theme/#post-1063456)
 * I had the same problem and tracked it down to an issue where the plugin processes
   its output twice if you have a 404 template.
 * Locate this block of code, somewhere around line 793 in askapache-google-404.
   php:
 *     ```
       /**
       	 * AAGoogle404Handler::handle_404()
       	 */
       	function handle_404()
       	{
       		//error_log(__FUNCTION__.':'.__LINE__);
       		global $wpdb, $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
       		if ( is_array($wp_query->query_vars) ) extract( $wp_query->query_vars, EXTR_SKIP );
   
       		ob_start();
       		@header( "HTTP/1.1 {$this->status_code} {$this->reason}", 1 );
       		@header( "Status: {$this->status_code} {$this->reason}", 1 );
   
       		if ( $this->status_code == 400 || $this->status_code == 403 || $this->status_code == 405 || (string )$this->status_code[0] == '5' ) return $this->handle_non_404();
   
       		if ( file_exists(TEMPLATEPATH . '/404.php') && is_file(TEMPLATEPATH . '/404.php') ) load_template( TEMPLATEPATH . '/404.php' );
       		else {
       			get_header();
   
       			$this->handle_it();
   
       			get_sidebar();
   
       			get_footer();
   
       		}
   
       		ob_flush(); flush();
       	}
       ```
   
 * You need to comment out the section that asks about whether you have a 404 template.
   So, your new function should look like this:
 *     ```
       /**
       	 * AAGoogle404Handler::handle_404()
       	 */
       	function handle_404()
       	{
       		//error_log(__FUNCTION__.':'.__LINE__);
       		global $wpdb, $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
       		if ( is_array($wp_query->query_vars) ) extract( $wp_query->query_vars, EXTR_SKIP );
   
       		ob_start();
       		@header( "HTTP/1.1 {$this->status_code} {$this->reason}", 1 );
       		@header( "Status: {$this->status_code} {$this->reason}", 1 );
   
       		if ( $this->status_code == 400 || $this->status_code == 403 || $this->status_code == 405 || (string )$this->status_code[0] == '5' ) return $this->handle_non_404();
   
       		/*
       		if ( file_exists(TEMPLATEPATH . '/404.php') && is_file(TEMPLATEPATH . '/404.php') ) load_template( TEMPLATEPATH . '/404.php' );
       		else {
       			get_header();
   
       			$this->handle_it();
   
       			get_sidebar();
   
       			get_footer();
   
       		}
       		*/
   
       		ob_flush(); flush();
       	}
       ```
   
 *  [gorky5](https://wordpress.org/support/users/gorky5/)
 * (@gorky5)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-askapache-google-404-breaks-my-theme/#post-1063458)
 * dougvdotcom – many thanks for posting this. I was having the same problem and
   couldn’t work out why.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: AskApache Google 404] Breaks my theme’ is closed to new replies.

 * 4 replies
 * 3 participants
 * Last reply from: [gorky5](https://wordpress.org/support/users/gorky5/)
 * Last activity: [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-askapache-google-404-breaks-my-theme/#post-1063458)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
