Title: Cannot Modify Headers &#8211; wp-includes/query.php:390
Last modified: August 19, 2016

---

# Cannot Modify Headers – wp-includes/query.php:390

 *  [AphelionZ](https://wordpress.org/support/users/aphelionz/)
 * (@aphelionz)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/cannot-modify-headers-wp-includesqueryphp390/)
 * Hello all,
 * I’m developing a plugin which makes use of the wp_redirect function. You can 
   see the relevant code here:
 * However, when I try to run that code I get this error.
 * Cannot modify header information – headers already sent by (output started at/
   path/to.site/wp-includes/query.php:390) in /path/to/site/wp-content/plugins/post_shock/
   postshock_core.php on line 53
 * Now, I checked query.php and nothing on line 390 seems to be creating any whitespace
   or sending any header info at all, so I suspect the problem might be deeper. 
   Any ideas or thoughts would be appreciated!

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

 *  [mrmist](https://wordpress.org/support/users/mrmist/)
 * (@mrmist)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/cannot-modify-headers-wp-includesqueryphp390/#post-1156515)
 * I’d expect that an error is being thrown somewhere, hence causing the problem.
   Are you running with wp_debug enabled?
 *  Thread Starter [AphelionZ](https://wordpress.org/support/users/aphelionz/)
 * (@aphelionz)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/cannot-modify-headers-wp-includesqueryphp390/#post-1156516)
 * Yeah, it’s all notices and warnings based on some other plugins BUT that warning
   is one of them.
 *  Thread Starter [AphelionZ](https://wordpress.org/support/users/aphelionz/)
 * (@aphelionz)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/cannot-modify-headers-wp-includesqueryphp390/#post-1156626)
 * I got it running now with no warnings, but it still doesn’t redirect for some
   reason – and its not calling any errors! Here’s the code in question:
 *     ```
       add_action('init', 'search_egg_redirect', 0);
   
       function search_egg_redirect() {
       	global $wpdb;
       	$query = $wpdb->prepare($_GET['s']);
   
       	if(!empty($query)) {
       		$term_row = $wpdb->get_row('SELECT term,page_id FROM pshock_searcheggs WHERE TERM="' . $query . '" LIMIT 1');
       		if($term_row->term) {
       			wp_redirect('http://google.com');
       		}
       	}
       }
       ```
   

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

The topic ‘Cannot Modify Headers – wp-includes/query.php:390’ is closed to new replies.

## Tags

 * [header information](https://wordpress.org/support/topic-tag/header-information/)
 * [modify headers](https://wordpress.org/support/topic-tag/modify-headers/)
 * [query.php](https://wordpress.org/support/topic-tag/query-php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [AphelionZ](https://wordpress.org/support/users/aphelionz/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/cannot-modify-headers-wp-includesqueryphp390/#post-1156626)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
